Removed some use of Grid._* in constraints.py.
authorEevee <eevee@nyarumaa.(none)>
Wed, 7 Jan 2009 13:51:39 +0000 (08:51 -0500)
committerEevee <eevee@nyarumaa.(none)>
Wed, 7 Jan 2009 13:51:39 +0000 (08:51 -0500)
pseudoku/grid/constraints.py

index 91f8287..2495102 100644 (file)
@@ -28,7 +28,7 @@ class Constraint(object):
         return possible_cells
 
     def resolve_uniques(self):
         return possible_cells
 
     def resolve_uniques(self):
-        for value in xrange(self.grid._size):
+        for value in xrange(self.grid.size):
             # XXX cache values that are taken care of
             possible_cells = self.find_value(value)
 
             # XXX cache values that are taken care of
             possible_cells = self.find_value(value)
 
@@ -48,11 +48,11 @@ class Constraint(object):
 
 class Box(Constraint):
     def _get_box_row(self):
 
 class Box(Constraint):
     def _get_box_row(self):
-        return self._pos // self.grid._box_width
+        return self._pos // self.grid.box_width
     box_row = property(_get_box_row)
 
     def _get_box_column(self):
     box_row = property(_get_box_row)
 
     def _get_box_column(self):
-        return self._pos % self.grid._box_height
+        return self._pos % self.grid.box_height
     box_column = property(_get_box_column)
 
     def __init__(self, grid, position):
     box_column = property(_get_box_column)
 
     def __init__(self, grid, position):
@@ -60,10 +60,10 @@ class Box(Constraint):
         self._pos = position
 
         self._cells = []
         self._pos = position
 
         self._cells = []
-        for row in xrange(self.grid._box_height):
-            for col in xrange(self.grid._box_width):
-                cell_row = row + self.box_row * self.grid._box_height
-                cell_col = col + self.box_column * self.grid._box_width
+        for row in xrange(self.grid.box_height):
+            for col in xrange(self.grid.box_width):
+                cell_row = row + self.box_row * self.grid.box_height
+                cell_col = col + self.box_column * self.grid.box_width
                 self._cells.append(ref(self.grid.cell(cell_row, cell_col)))
 
 
                 self._cells.append(ref(self.grid.cell(cell_row, cell_col)))
 
 
@@ -73,7 +73,7 @@ class Row(Constraint):
         self._pos = position
 
         self._cells = []
         self._pos = position
 
         self._cells = []
-        for col in xrange(self.grid._size):
+        for col in xrange(self.grid.size):
             self._cells.append(ref(self.grid.cell(self._pos, col)))
 
 class Column(Constraint):
             self._cells.append(ref(self.grid.cell(self._pos, col)))
 
 class Column(Constraint):
@@ -82,7 +82,7 @@ class Column(Constraint):
         self._pos = position
 
         self._cells = []
         self._pos = position
 
         self._cells = []
-        for row in xrange(self.grid._size):
+        for row in xrange(self.grid.size):
             self._cells.append(ref(self.grid.cell(row, self._pos)))
 
 class Diagonal(Constraint):
             self._cells.append(ref(self.grid.cell(row, self._pos)))
 
 class Diagonal(Constraint):