1

I'm working on a program supposed to solve a "Virus game". In short, we get a I x J board filled with fields coloured from an n-element colour pool. We start by marking the [0,0] field as "visited". The goal is to mark all fields as visited in the lowest amount of steps, each step being: choose a colour from the pool and colour each visited field with it. Then mark each field in regions neighboring visited fields of the same color as them as visited.

I've got some ideas about how to approach this problem, but I'd appreciate it if someone could point me to some good algorithm that I could modify to work in a reasonable time.

Here is the game link for reference if my explaination is unclear http://www.gry.pl/gra/virus_3

Marcin
  • 380
  • 3
  • 20
  • 1
    Look at my answer to this problem: http://stackoverflow.com/questions/32617961/minimum-number-of-clicks-to-solve-flood-it-like-puzzle/32621233#32621233 It is about the same game (Flood-It), but with one difference: e.g. if the corner square is orange, the square next to it is pink, and the square next to that is orange again, then all three squares will be converted if you click the pink one. In the version you linked to, the third square would remain orange. – m69's been on strike for years Dec 14 '15 at 03:38
  • This question being marked as duplicate is probably my fault; sorry about that; initially I didn't realise that the rules are slightly different. – m69's been on strike for years Dec 14 '15 at 22:27

1 Answers1

1

I'd completely forgotten about this game, which I used to enjoy playing from time to time.

I would probably just go greedy and pick the move that covers most new squares and, in case of a tie, pick the one that would give me most mobility in the following move.

  • 1
    Thinking about it more, I suppose more advanced heuristics might be called for, like you to try to head for the center of the board first, and you could look for "enclosed" areas that can only be accessed after a certain colors has been played and then try to open those open. – 500 - Internal Server Error Dec 13 '15 at 20:47
  • That was what I thought about as well, but the problem is the solution we get isn't guaranteed to be the best one, just one that works (unless we exceed the limit of moves, where the best solution would fit in that limit, in which case this is not an acceptable answer). I'm thinking a good idea would be to evaluate each board-state with some score (no idea how to calculate that yet) and try to improve it with each move. Some backtracking might also be in order – Marcin Dec 13 '15 at 20:52