Menus in progress
[getaclue.git] / crosswordpuzzle.py
index c1f822b..fb9ada5 100644 (file)
@@ -156,40 +156,6 @@ class CrosswordPuzzle:
                        self.data[row][col+i].char = word[i].upper ()
                        self.data[row][col+i].occupied_across = True
 
-       # display the grid with words
-       def print_grid (self, no_words=False):
-               # get row, col and print them (with grid number if set)
-               for col in range (self.cols):
-                       # print the first row as column headers
-                       print self.BLUE + '  ' + str (col) + self.ENDCOL,
-               print
-
-               for row in range (self.rows):
-                       for col in range (self.cols):
-                               # print the data
-                               # if the cell is numbered i.e. start of a word
-                               if self.data[row][col].numbered != 0:
-                                       print self.BRICKRED + str(self.data[row][col].numbered) + self.ENDCOL,
-                               # print a space
-                               else:
-                                       print ' ',
-                               # if the character is not a blank or a block
-                               if self.data[row][col].char <> "." and self.data[row][col].char <> "#":
-                                       # if words are to be shown regardless of hidden/revealed state
-                                       if no_words is False:
-                                               print self.BOLD + self.data[row][col].char + self.ENDCOL,
-                                       else:
-                                               # display only revealed
-                                               if self.data[row][col].revealed is True:
-                                                       print self.BOLD + self.data[row][col].char + self.ENDCOL,
-                                               # else print a block
-                                               else:
-                                                       print self.GREY + '.' + self.ENDCOL,
-                               else:
-                                       print self.GREY + self.data[row][col].char + self.ENDCOL,
-
-                       print ' ' + self.BLUE + str(row) + self.ENDCOL
-
        # freeze the grid numbers etc.
        def freeze_grid (self):
                # numbering
@@ -208,3 +174,13 @@ class CrosswordPuzzle:
 
                self.frozen_grid = True
 
+       # unfreeze the grid numbers etc.
+       def unfreeze_grid (self):
+               # run through the grid
+               for row in range (self.rows):
+                       for col in range (self.cols):
+                               self.data[row][col].numbered = 0
+                               if (self.data[row][col].occupied_across is False and
+                                       self.data[row][col].occupied_down is False):
+                                       self.data[row][col].char = '.'
+