def __iter__(self): for row, nrow in two_finger(self.rows): yield self.row(row) divider = self.divider(row, nrow) if "-" in divider: yield divider yield self.row(nrow)
def irow(self, row): for square, nsquare in two_finger(row): yield self.square(square) yield " " if self.puzzle.in_same_region(square, nsquare) else "|" yield self.square(nsquare)
def idivider(self, row, nrow): seperator = ["-" * self.vwidth, " " * self.vwidth] for (square, dsquare), (rsquare, csquare) in two_finger(zip(row, nrow)): yield seperator[self.puzzle.in_same_region(square, dsquare)] yield self.corner(square, rsquare, dsquare, csquare) yield seperator[self.puzzle.in_same_region(square, dsquare)]