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