本文整理汇总了Python中Solver.Solver.solve方法的典型用法代码示例。如果您正苦于以下问题:Python Solver.solve方法的具体用法?Python Solver.solve怎么用?Python Solver.solve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Solver.Solver
的用法示例。
在下文中一共展示了Solver.solve方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _solve_sudoku
# 需要导入模块: from Solver import Solver [as 别名]
# 或者: from Solver.Solver import solve [as 别名]
def _solve_sudoku(read_grid):
solver = Solver(read_grid)
if solver.solve():
return solver.sudoku_grid
else:
return None
示例2: len
# 需要导入模块: from Solver import Solver [as 别名]
# 或者: from Solver.Solver import solve [as 别名]
ny = 0
first_col = data[1].index('|')
nx = data[1][first_col:].index('|', 1) -1
data2 = []
for line in data:
data2.append(''.join([x for x in line if x in '1234567890.']))
data2 = [x for x in data2 if x]
ny = len(data2) / nx
# print nx, ny
# print '\n'.join(data2)
board = Board(nx, ny)
for y, line in enumerate(data2):
for x, value in enumerate(line):
if value in '123456789':
board.set(x, y, int(value)-1)
return board
b = read_board('boards/test1.ss')
b.display()
solver = Solver(b)
solver.solve()
b.display()