MCPcopy Create free account
hub / github.com/asweigart/PythonStdioGames / hasLost

Function hasLost

src/gamesbyexample/checkers.py:284–291  ·  view source on GitHub ↗

Return True if player has no checkers, otherwise False.

(board, player)

Source from the content-addressed store, hash-verified

282
283
284def 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:

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected