本文整理汇总了Python中sudoku.Sudoku.find_open_pairs方法的典型用法代码示例。如果您正苦于以下问题:Python Sudoku.find_open_pairs方法的具体用法?Python Sudoku.find_open_pairs怎么用?Python Sudoku.find_open_pairs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sudoku.Sudoku
的用法示例。
在下文中一共展示了Sudoku.find_open_pairs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Test
# 需要导入模块: from sudoku import Sudoku [as 别名]
# 或者: from sudoku.Sudoku import find_open_pairs [as 别名]
class Test(unittest.TestCase):
def setUp(self):
str_sudoku = """043980250
600425000
200001094
900004070
300608000
410209003
820500000
000000005
534890710"""
int_sudoku = []
for line in str_sudoku.split("\n"):
int_sudoku.append([int(i) for i in list(line.strip())])
self.s = Sudoku(int_sudoku)
def testFindOpenPairs(self):
# 2 IS HIDDEN LONGER
c1 = CellData(0) #
c1.suggests = [2, 3, 5, 7]
c2 = CellData(9)
c3 = CellData(4)
c4 = CellData(0)
c4.suggests = [1, 2, 5]
c5 = CellData(0)
c5.suggests = [1, 5]
c6 = CellData(8)
c7 = CellData(6)
c8 = CellData(0)
c8.suggests = [1, 3, 5, 7]
c9 = CellData(0)
c9.suggests = [1, 5]
cells = [c1, c2, c3, c4, c5, c6, c7, c8, c9]
pair, positions = self.s.find_open_pairs(cells)
print pair
print positions