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

Function getValidMoves

src/gamesbyexample/reversegam.py:75–84  ·  view source on GitHub ↗

Returns a list of [x, y] lists of valid moves for the given player on the given board.

(board, tile)

Source from the content-addressed store, hash-verified

73
74
75def getValidMoves(board, tile):
76 """Returns a list of [x, y] lists of valid moves for the given
77 player on the given board."""
78 validMoves = []
79
80 for x in range(8):
81 for y in range(8):
82 if isValidMove(board, tile, x, y) != False:
83 validMoves.append([x, y])
84 return validMoves
85
86
87def isValidMove(board, tile, xstart, ystart):

Callers 3

mainFunction · 0.70
getBoardWithValidMovesFunction · 0.70
getComputerMoveFunction · 0.70

Calls 1

isValidMoveFunction · 0.70

Tested by

no test coverage detected