Esempio n. 1
0
def solve_board(file_path):
    # Load in board, and time how long it takes to solve.
    board = IO.load_board(file_path)
    start_time = datetime.datetime.now()
    solved_board, result = BruteForce.brute_force(board)
    end_time = datetime.datetime.now()

    # Calculate the difference between the start and end time
    diff_time = end_time - start_time

    # Get the time in seconds
    time = float(diff_time.seconds) + float(diff_time.microseconds) / float(1000000)

    # Display information to the user.
    print time
    print "\nOriginal Board\n"
    IO.print_board(board)
    print "\nSolved Board\n"
    IO.print_board(solved_board)

    return solved_board, result
Esempio n. 2
0
    def test_loadBoard(self):

        loaded_board = IO.load_board('Unit Test Board 1.txt')
        self.assertEqual(loaded_board, self.solvedBoard1)