Esempio n. 1
0
 def test_example_5(self):
     clues = (((3, 1, 3, 1, 3), (2, 1, 1, 7, 1, 2), (3, 2, 1, 2, 1), (2, 1, 2, 1, 1), (1, 2, 2), (3, 3, 3, 1, 1), (4, 6, 1, 1, 1), (8, 3, 2, 1, 2), (11, 1, 1), (1, 2, 7, 1, 2, 1, 1), (1, 3, 2, 1, 1, 3, 1, 1), (2, 6, 5, 2), (2, 3, 4, 1, 3), (3, 2, 2, 1, 1, 1, 3), (3, 1, 2, 1, 6, 1, 1), (8, 5, 2, 1, 1), (6, 1, 4, 2, 2), (8, 4, 1, 3, 1), (2, 15, 1), (2, 4, 9), (3, 10), (1, 5, 2, 2, 2), (7, 5, 2), (2, 1, 4, 2, 1, 1), (2, 8, 2, 1)), ((3, 6), (2, 5, 7), (2, 6, 5, 1), (1, 2, 4, 5, 2), (1, 2, 1, 5, 2), (4, 6, 3, 1), (8, 5, 1, 1), (3, 4, 5, 1, 4), (1, 2, 5, 8), (1, 9, 1, 2, 2, 1), (1, 6, 1, 1, 3, 4), (2, 1, 1, 2, 1, 1, 3, 4), (3, 1, 2, 2, 5, 3), (2, 2, 4, 6, 2), (1, 1, 1, 1, 1, 6, 3, 1), (1, 1, 1, 1, 2, 4, 1), (2, 3, 7, 3, 2), (1, 1, 9), (1, 1, 2, 1, 8, 1), (2, 1, 1, 2, 4, 2), (1, 5), (2, 1, 4), (1, 1, 1, 2, 2, 1, 1), (3, 3, 3), (2, 6, 1, 1, 4)))
     args = (25, 25)
     gram = Nonogram(clues,*args)
     output = gram.solve()
     print(output)
     assert output is not None
Esempio n. 2
0
 def test_example_4(self):
     clues = (((7, 4, 4, 4), (3, 5, 1, 8), (2, 1, 2, 3), (2, 4, 1, 2, 1), (1, 3, 3, 1, 1), (2, 13, 1), (3, 1, 3, 5, 1, 2), (2, 7, 7, 2), (3, 1, 4, 1, 9), (3, 5, 2, 3, 2), (2, 1, 4, 1, 3, 1), (2, 1, 7, 3, 1), (8, 1, 3, 2), (1, 1, 8, 1, 1, 3), (13, 2, 1, 1), (6, 12, 2), (3, 11, 2), (1, 4, 10, 2), (11, 3), (5, 5, 2, 1, 1), (2, 1, 4, 3, 1, 3), (6, 4, 1, 3), (5, 3, 1, 4), (5, 1, 1, 1, 1, 4), (4, 3, 3)), ((3, 7, 1, 4), (3, 8, 3, 5), (2, 1, 2, 2, 5), (1, 2, 5, 4), (1, 4, 4), (2, 1, 3, 7, 1), (2, 3, 7, 1, 1), (1, 2, 8, 3), (3, 11, 3, 1), (2, 12, 4), (1, 1, 4, 13), (2, 1, 1, 8, 1), (1, 2, 9, 1), (1, 3, 8, 2), (1, 3, 6, 1, 1), (6, 5), (1, 9, 1, 6), (11, 5), (2, 18), (2, 1, 2, 2, 8), (1, 1, 9, 1, 3), (2, 1, 3, 1, 2), (5, 3, 1, 1, 2, 2), (3, 1, 1, 2, 4, 2), (6, 8, 2)))
     args = (25, 25)
     gram = Nonogram(clues,*args)
     output = gram.solve()
     print(output)
     assert output is not None
Esempio n. 3
0
 def test_example_3(self):
     clues = (((3,), (4,), (3,), (2,), (1,)),
             ((3,), (3,), (3,), (2,), (2,)))
     ans = ((0, 0, 1, 1, 1),
            (0, 1, 1, 1, 0),
            (1, 1, 1, 0, 0),
            (1, 1, 0, 0, 0),
            (1, 1, 0, 0, 0))
     gram = Nonogram(clues)
     print(gram.solve())
     assert gram.solve() == ans
Esempio n. 4
0
 def test_all(self):
     for i,test in enumerate(self.tests):
         param, result = test
         r = Nonogram(*param).solve()
         assert r == result
         string = f'{i}: {r} Should_Equal {result} '
         string = string + ' Correct!' if r == result else string + ' Incorrect!'
         print(string,"\n")