public void Flip(int x, int y)
 {
     grid.Imbue(x, y);
     UpdateButton(x, y);
     UpdateButton(x - 1, y);
     UpdateButton(x, y - 1);
     UpdateButton(x + 1, y);
     UpdateButton(x, y + 1);
 }
Exemple #2
0
        public (List <int> codes, int score) Solve(TileGrid grid)
        {
            int gridCode = 0;

            for (int i = 0; i < Size * Size; i++)
            {
                if (grid.State[i % Size, i / Size])
                {
                    gridCode ^= 1 << i;
                }
            }

            var solution = Solve(gridCode);

            for (int i = 0; i < Size * Size; i++)
            {
                if ((solution.codes[0] & 1 << i) != 0)
                {
                    grid.Imbue(i % Size, i / Size);
                }
            }
            return(solution);
        }