Exemplo n.º 1
0
 def prettyprint(self):
     s = ["--------------------------------------------------------"]
     for row in self.rows:
         for index in xrange(self._size):
             ss = []
             for cell in row:
                 sss = []
                 cellRow = cell.getRow(index)
                 for element in cellRow:
                     sss.append("%(V)04s"%{"V":element.getValue()})
                 ss.append(", ".join(sss))
             s.append("[ "+"| ".join(ss)+" ]")
         s.append("--------------------------------------------------------")
     s1 = ["--------------------------------------------------------"]
     for row in self.rows:
         for index in xrange(self._size):
             ss = []
             for cell in row:
                 sss = []
                 cellRow = cell.getRow(index)
                 for element in cellRow:
                     poss = element.getPossibles()
                     if len(poss)==0:
                         poss = "[None]"
                     else:
                         poss = "%(V)s"%{"V":list(poss)}
                     sss.append(poss)
                 ss.append(", ".join(sss))
             s1.append("[ "+"| ".join(ss)+" ]")
         s1.append("--------------------------------------------------------")
     for index in xrange(len(s)):
         s[index] = s[index] + "    " + s1[index]
     return "\n".join(s)
Exemplo n.º 2
0
 def getElementRows(self):
     for cells in self.rows:
         for index in xrange(self._size):
             row = []
             for cell in cells:
                 row.extend(cell.getRow(index))
             yield row