Exemplo n.º 1
0
        public void TestUniquenessCheck_Hard_v3()
        {
            Console.WriteLine("==========================");
            Console.WriteLine("    Uniqueness Test");
            Console.WriteLine("==========================");

            // test with unique sudoku
            DateTime start    = DateTime.Now;
            var      sudoku   = getDifficultTestSudoku();
            bool     isUnique = new Algorithms.v3.SudokuSolver().HasSudokuUniqueSolution(sudoku);

            Console.WriteLine(isUnique.ToString());
            DateTime end = DateTime.Now;

            Assert.True(isUnique);

            Console.WriteLine($"check for uniqueness of a unique sudoku took { (end - start).TotalMilliseconds }ms");
            Console.WriteLine("");

            // test with non-unique sudoku
            start    = DateTime.Now;
            sudoku   = getNonUniqueTestSudoku();
            isUnique = new Algorithms.v3.SudokuSolver().HasSudokuUniqueSolution(sudoku);
            Console.WriteLine(isUnique.ToString());
            end = DateTime.Now;

            Assert.True(!isUnique);

            Console.WriteLine($"check for uniqueness of a non-unique sudoku took { (end - start).TotalMilliseconds }ms");
            Console.WriteLine("");
        }
Exemplo n.º 2
0
        public void TestUniquenessCheck_Easy_v3()
        {
            Console.WriteLine("==========================");
            Console.WriteLine("    Uniqueness Test");
            Console.WriteLine("==========================");

            DateTime start    = DateTime.Now;
            var      sudoku   = getEasyTestSudoku();
            var      isUnique = new Algorithms.v3.SudokuSolver().HasSudokuUniqueSolution(sudoku);

            Console.WriteLine(isUnique.ToString());
            DateTime end = DateTime.Now;

            Console.WriteLine($"solving sudoku took { (end - start).TotalMilliseconds }ms");
            Console.WriteLine("");
        }