Return True if player has no checkers, otherwise False.
(board, player)
| 272 | |
| 273 | |
| 274 | def hasLost(board, player): |
| 275 | """Return True if player has no checkers, otherwise False.""" |
| 276 | assert player in ('X', 'O') |
| 277 | for row in range(1, 9): |
| 278 | for column in ALL_COLUMNS: |
| 279 | if board.get(column + str(row), '').upper() == player: |
| 280 | return False |
| 281 | return True |
| 282 | |
| 283 | |
| 284 | # If this program was run (instead of imported), run the game: |