Пример #1
0
        private static bool SolveWithStyle(Board board)
        {
            board.Print();
            Console.Out.WriteLine();
            int[] gridSpace;
            if ((gridSpace = FindNextZero(board)) == null)
            {
                return(true);
            }

            for (int i = 1; i <= 9; i++)
            {
                board.grid[gridSpace[0], gridSpace[1]].setValue(i);
                if (board.CheckGridSpace(gridSpace) == true)
                {
                    if (SolveWithStyle(board) == true)
                    {
                        return(true);
                    }
                }
            }

            board.grid[gridSpace[0], gridSpace[1]].setValue(0);

            return(false);
        }