Returns True if the board is full of tiles, otherwise, returns False if there is an empty space somewhere on the board.
(board)
| 182 | |
| 183 | |
| 184 | def isBoardFull(board): |
| 185 | """Returns True if the board is full of tiles, otherwise, returns |
| 186 | False if there is an empty space somewhere on the board.""" |
| 187 | for x in range(BOARD_WIDTH): |
| 188 | for y in range(BOARD_HEIGHT): |
| 189 | if board[(x, y)] == EMPTY_SPACE: |
| 190 | # An empty space means the board is not full. |
| 191 | return False |
| 192 | return True # None of the spaces were empty, so the board is full. |
| 193 | |
| 194 | |
| 195 | # If the program is run (instead of imported), run the game: |