Пример #1
0
 def test_read_new_board(self):
     board = sdk_reader.read(open("data/00-nakedsubset1.sdk"))
     as_printed = str(board)
     self.assertEqual(
         as_printed,
         "32...14..\n9..4.2..3\n..6.7...9\n8.1..5...\n...1.6...\n...7..1.8\n1...9.5..\n2..8.4..7\n..45...31"
     )
Пример #2
0
def main():
    args = cli()
    board = sdk_reader.read(args.file)
    if args.display:
        display = sdk_display.Board(board, 800, 800)
    if board.is_consistent():
        board.solve()
    else:
        print("Board has duplicates; rejected")
    print(board)

    if args.display:
        input("Press enter to shut down")
        display.close
Пример #3
0
def main():
    args = cli()
    board = sdk_reader.read(args.file)
    if args.display:
        display = sdk_display.Board(board, 800, 800)
        # pause = input("Press enter to continue")
    if board.is_consistent():
        # Pause if there is a display
        if args.display:
            input("Press enter to solve")
        board.solve()
        assert board.is_consistent()
    else:
        print("Board has duplicates; rejected")
    print(board)

    if args.display:
        input("Press enter to shut down")
        display.close()