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

Function hasWon

src/gamesbyexample/flooder.py:208–216  ·  view source on GitHub ↗

Return True if the entire board is one color/shape.

(board)

Source from the content-addressed store, hash-verified

206
207
208def hasWon(board):
209 """Return True if the entire board is one color/shape."""
210 tile = board[(0, 0)]
211
212 for x in range(BOARD_WIDTH):
213 for y in range(BOARD_HEIGHT):
214 if board[(x, y)] != tile:
215 return False
216 return True
217
218
219# 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