good evening,
I'm trying to solve an algorithm problem, I can't. A problem that looks like a cellular automaton.
I can not find a good algorithm, I try bruteforce; A lot of things...
If anyone has a solution; which algorithm would fit best?
Explanation of the game
The object of the game is to reverse the value of the cells (except for -1 which will have to keep its location).
Indeed, each cell contains a value:
gray = -1
white = 0
red = 1
This game is performed per round, and each round is associated with a value (1 or 0), for example:
(The associated values are known in advance and start with 0, then 1, then 0 then 1, then 0 ..)
Round 1 X = 0
Round 2 X = 1
Round 3 X = 0
Round 4 X = 1
I can exchange the value -1, with a linked cell that is equal to the value of the turn. The two values of the cells are exchanged.
I can only exchange one cell per turn in the nodes of your choice.
No limit of turn is imposed.