def parse_file(self): file_path = filedialog.askopenfilename(title="Open a file...") if file_path: self.clear() self.board_tile, self.tiles = parse_puzzle(file_path) self.filename.set("filename: " + path.basename(file_path)) self.show_tiles()
from sys import argv from read import parse_puzzle, print_board from solver import Solver import time if __name__ == '__main__': if len(argv) < 2: print('please supply the puzzle file') else: board, tiles = parse_puzzle(argv[1]) print_board(board.get_tile_grid()) for t in tiles: print_board(t.get_tile_grid()) solver = Solver(tiles, board) print('\nstarting solution process') start = time.time() solver.solve_puzzle() end = time.time() - start print('total solutions:', len(solver.solutions)) print('time taken:', end)