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

Function hasLost

src/gamesbyexample/chancecheckers.py:274–281  ·  view source on GitHub ↗

Return True if player has no checkers, otherwise False.

(board, player)

Source from the content-addressed store, hash-verified

272
273
274def 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:

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected