Display the current state of the grid on the screen.
(self)
| 82 | self.grid = copy.copy(self.moves[-1]) |
| 83 | |
| 84 | def display(self): |
| 85 | """Display the current state of the grid on the screen.""" |
| 86 | print(' A B C D E F G H I') # Display column labels. |
| 87 | for y in range(GRID_LENGTH): |
| 88 | for x in range(GRID_LENGTH): |
| 89 | if x == 0: |
| 90 | # Display row label: |
| 91 | print(str(y + 1) + ' ', end='') |
| 92 | |
| 93 | print(self.grid[(x, y)] + ' ', end='') |
| 94 | if x == 2 or x == 5: |
| 95 | # Display a vertical line: |
| 96 | print('| ', end='') |
| 97 | print() # Print a newline. |
| 98 | |
| 99 | if y == 2 or y == 5: |
| 100 | # Display a horizontal line: |
| 101 | print(' ------+-------+------') |
| 102 | |
| 103 | def _isCompleteSetOfNumbers(self, numbers): |
| 104 | """Return True if numbers contains the digits 1 through 9.""" |