コード例 #1
0
ファイル: test_dlx.py プロジェクト: mharrys/sudoku
    def test_no_solution(self):

        def callback(solutions, s):
            self.assertTrue(False)

        problem = array([[]])
        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)

        problem = array([[0]])
        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)

        problem = array([[0, 0],
                         [0, 0]])
        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)

        problem = array([[0, 1]])
        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)

        problem = array([[1, 0, 0],
                         [0, 0, 0],
                         [0, 0, 1]])
        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)
コード例 #2
0
ファイル: test_dlx.py プロジェクト: ChristerNilsson/2020
    def test_problem_1(self):
        def callback(solutions, s):
            self.validate([1], solutions, s)

        problem = array([[1]])

        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)
コード例 #3
0
ファイル: test_dlx.py プロジェクト: mharrys/sudoku
    def test_problem_1(self):

        def callback(solutions, s):
            self.validate([1], solutions, s)

        problem = array([[1]])

        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)
コード例 #4
0
ファイル: test_dlx.py プロジェクト: ChristerNilsson/2020
    def test_problem_3(self):
        def callback(solutions, s):
            self.validate([2, 4, 6], solutions, s)

        problem = array([[1, 0, 0, 1, 0, 0, 1], [1, 0, 0, 1, 0, 0, 0],
                         [0, 0, 0, 1, 0, 0, 1], [0, 0, 1, 0, 1, 1, 0],
                         [0, 1, 1, 0, 0, 1, 1], [0, 1, 0, 0, 0, 0, 1]])

        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)
コード例 #5
0
ファイル: test_dlx.py プロジェクト: ChristerNilsson/2020
    def test_no_solution(self):
        def callback(solutions, s):
            self.assertTrue(False)

        problem = array([[]])
        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)

        problem = array([[0]])
        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)

        problem = array([[0, 0], [0, 0]])
        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)

        problem = array([[0, 1]])
        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)

        problem = array([[1, 0, 0], [0, 0, 0], [0, 0, 1]])
        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)
コード例 #6
0
ファイル: test_dlx.py プロジェクト: mharrys/sudoku
    def test_problem_3(self):

        def callback(solutions, s):
            self.validate([2, 4, 6], solutions, s)

        problem = array([[1, 0, 0, 1, 0, 0, 1],
                         [1, 0, 0, 1, 0, 0, 0],
                         [0, 0, 0, 1, 0, 0, 1],
                         [0, 0, 1, 0, 1, 1, 0],
                         [0, 1, 1, 0, 0, 1, 1],
                         [0, 1, 0, 0, 0, 0, 1]])

        dlx = DLX.from_matrix(problem, callback)
        dlx.run(True)