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

Function makeMove

src/gamesbyexample/pygame_games/flippy.py:460–475  ·  view source on GitHub ↗
(board, tile, xstart, ystart, realMove=False)

Source from the content-addressed store, hash-verified

458
459
460def makeMove(board, tile, xstart, ystart, realMove=False):
461 # Place the tile on the board at xstart, ystart, and flip tiles
462 # Returns False if this is an invalid move, True if it is valid.
463 tilesToFlip = isValidMove(board, tile, xstart, ystart)
464
465 if tilesToFlip == False:
466 return False
467
468 board[xstart][ystart] = tile
469
470 if realMove:
471 animateTileChange(tilesToFlip, tile, (xstart, ystart))
472
473 for x, y in tilesToFlip:
474 board[x][y] = tile
475 return True
476
477
478def isOnCorner(x, y):

Callers 2

runGameFunction · 0.70
getComputerMoveFunction · 0.70

Calls 2

animateTileChangeFunction · 0.85
isValidMoveFunction · 0.70

Tested by

no test coverage detected