Пример #1
0
        static void Main(string[] args)
        {
            try
            {
                SudokuMapper sudokuMapper = new SudokuMapper();
                SudokuBoard  sudokuBoard  = new SudokuBoard();
                SudokuEngine sudokuEngine = new SudokuEngine(sudokuBoard, sudokuMapper);
                SudokuReader sudokuReader = new SudokuReader();

                Console.WriteLine("Please enter the Sudoku file name:");
                var filename = Console.ReadLine();

                var sudoku = sudokuReader.ReadFile(filename);
                sudokuBoard.Show(sudoku);

                bool isSudoKuSolved = sudokuEngine.Solve(sudoku);
                sudokuBoard.Show(sudoku);

                Console.WriteLine(isSudoKuSolved
                    ? "Sudoku is solved."
                    : "Unfortunately, current algorithm(s) were not enough to solve the Sudoku.");
            }
            catch (Exception e)
            {
                Console.WriteLine("{0}:{1}", "Something go wrong! ", e.Message);
            }
        }
Пример #2
0
 private static void setupReader()
 {
     sudokuReader = new SudokuReader("..\\..\\..\\res\\sudoku.json");
 }
Пример #3
0
 static void Main(string[] args)
 {
     int[] sudokuGrid = SudokuReader.readGrid("./TestProblems/sudokuprufa2.txt");
     Solver.solve(sudokuGrid);
     Console.WriteLine("búið");
 }