Exemplo n.º 1
0
        private void solverButton_Click(object sender, EventArgs e)
        {
            SudokuSolver _solver = new SudokuSolver();

            var(completedBoard, finishedBoard) = _solver.SolveBoard(_sudoku.sudokuBoard, 0, 0, false);

            if (finishedBoard)
            {
                _sudoku.sudokuBoard = completedBoard;
                FinishSudoku(_sudoku.sudokuBoard);
                SudokuCompleteForm completeForm = new SudokuCompleteForm();
                completeForm.ShowDialog();
            }
        }
Exemplo n.º 2
0
        private void checkAnswerButton_Click(object sender, EventArgs e)
        {
            SudokuSolver _solver = new SudokuSolver();
            var          answer  = _solver.CheckAnswer(_sudoku);

            if (answer)
            {
                SudokuCompleteForm completeForm = new SudokuCompleteForm();
                completeForm.ShowDialog();
            }
            else
            {
                SudokuNotCompleteForm notCompleteForm = new SudokuNotCompleteForm();
                notCompleteForm.ShowDialog();
            }
        }
Exemplo n.º 3
0
        void prepareFullGrids()
        {
            gridFull.Clear();
            SudokuSolver sudokuSolver = new SudokuSolver(gridEmpty);

            for (int k = 0; k < GridsPerLevel; ++k)
            {
                gridFull.Add(sudokuSolver.Execute());
            }

            var lvls = new Level[4] {
                Level.Easy, Level.Medium, Level.Hard, Level.Evil
            };

            foreach (var e in lvls)
            {
                AllGrids[e] = new List <string>();
            }
        }