Let the player enter the car and direction they want to move.
(board)
| 205 | |
| 206 | |
| 207 | def askForPlayerMove(board): |
| 208 | """Let the player enter the car and direction they want to move.""" |
| 209 | validMoves = getValidMoves(board) |
| 210 | while True: |
| 211 | allValidMoves = '", "'.join(validMoves) |
| 212 | print('Moves: "{}", "RESET", or "QUIT".'.format(allValidMoves)) |
| 213 | move = input('> ').upper() |
| 214 | if move == 'QUIT': |
| 215 | sys.exit() |
| 216 | if move == 'RESET': |
| 217 | return 'RESET' |
| 218 | if move in validMoves: |
| 219 | return move |
| 220 | |
| 221 | |
| 222 | # If this program was run (instead of imported), run the game: |