Return True if player has no checkers, otherwise False.
(board, player)
| 282 | |
| 283 | |
| 284 | def hasLost(board, player): |
| 285 | """Return True if player has no checkers, otherwise False.""" |
| 286 | assert player in ('X', 'O') |
| 287 | for row in range(1, 9): |
| 288 | for column in ALL_COLUMNS: |
| 289 | if board.get(column + str(row), '').upper() == player: |
| 290 | return False |
| 291 | return True |
| 292 | |
| 293 | |
| 294 | # If this program was run (instead of imported), run the game: |