当前位置: 首页>>代码示例>>Python>>正文


Python Solver.solve_puzzle方法代码示例

本文整理汇总了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"))
开发者ID:sp5pe,项目名称:tiles,代码行数:14,代码来源:gui.py

示例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)
开发者ID:sp5pe,项目名称:tiles,代码行数:26,代码来源:solve_puzzle.py


注:本文中的solver.Solver.solve_puzzle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。