本文整理汇总了Python中solver.Solver.solve_puzzle方法的典型用法代码示例。如果您正苦于以下问题:Python Solver.solve_puzzle方法的具体用法?Python Solver.solve_puzzle怎么用?Python Solver.solve_puzzle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类solver.Solver
的用法示例。
在下文中一共展示了Solver.solve_puzzle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: solve_puzzle
# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import solve_puzzle [as 别名]
def solve_puzzle(self):
if self.board_tile and self.tiles:
solver = Solver(self.tiles, self.board_tile)
solver.solutions_counter = self.solutions
solver.solutions_frame = self.solutions_frame
time = solver.solve_puzzle()
print("time taken:", time)
self.canvas_sol_holder.create_window(0, 0, anchor=NW, window=self.solutions_frame)
self.solutions_frame.update_idletasks()
self.canvas_sol_holder.config(scrollregion=self.canvas_sol_holder.bbox("all"))
示例2: len
# 需要导入模块: from solver import Solver [as 别名]
# 或者: from solver.Solver import solve_puzzle [as 别名]
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)