Display the board, robots, and player on the screen.
(board, robots, playerPosition)
| 119 | |
| 120 | |
| 121 | def displayBoard(board, robots, playerPosition): |
| 122 | """Display the board, robots, and player on the screen.""" |
| 123 | # Loop over every space on the board: |
| 124 | for y in range(HEIGHT): |
| 125 | for x in range(WIDTH): |
| 126 | # Draw the appropriate character: |
| 127 | if board[(x, y)] == WALL: |
| 128 | print(WALL, end='') |
| 129 | elif board[(x, y)] == DEAD_ROBOT: |
| 130 | print(DEAD_ROBOT, end='') |
| 131 | elif (x, y) == playerPosition: |
| 132 | print(PLAYER, end='') |
| 133 | elif (x, y) in robots: |
| 134 | print(ROBOT, end='') |
| 135 | else: |
| 136 | print(EMPTY_SPACE, end='') |
| 137 | print() # Print a newline. |
| 138 | |
| 139 | |
| 140 | def askForPlayerMove(board, robots, playerPosition): |