本文整理汇总了Python中sudoku.Sudoku.other方法的典型用法代码示例。如果您正苦于以下问题:Python Sudoku.other方法的具体用法?Python Sudoku.other怎么用?Python Sudoku.other使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sudoku.Sudoku
的用法示例。
在下文中一共展示了Sudoku.other方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _check_intersect
# 需要导入模块: from sudoku import Sudoku [as 别名]
# 或者: from sudoku.Sudoku import other [as 别名]
def _check_intersect(s, h1, h2):
# When two houses intersect,
# some numbers cannot at the same time be outside of the intersection
# Thus they must be inside the intersection
changed = 0
log.append("In House {0} & {1}:", h1, h2)
h1u = util.difference(h1, h2) # h1 unique tiles
h2u = util.difference(h2, h1) # h2 unique tiles
h1un = s.get_numbers(h1u) # h1 unique numbers
h2un = s.get_numbers(h2u) # h2 unique numbers
h1i = Sudoku.other(h1un) # h1 intersect-only numbers
h2i = Sudoku.other(h2un) # h2 intersect-only numbers
hi = util.union(h1i, h2i) # intersect-only numbers
if len(hi) > 0:
@log.rollback
def rem():
log.indent()
log.append("Intersection contains {0}", hi)
log.indent()
result = max(section_remove(s, h2u, h1i), section_remove(s, h1u, h2i))
log.dedent(2)
return result
changed = rem()
return changed