checks if an and coordinate is actually on the game board for examplean coordinate of and coordinate of would not be on the board since coordinates only go up to getting list with all valid moves def getboardwithvalidmoves(boardtile) returns new board with marking the valid moves the given player can make dupeboard getboardcopy(board for xy in getvalidmoves(dupeboardtile) dupeboard[ ][ return dupeboard getboardwithvalidmoves(returns game board data structure that has characters for all spaces that are valid moves the periods are for the hints mode that displays board with all possible moves marked on it this function creates duplicate game board data structure (returned by getboardcopy(on line instead of modifying the one passed to it in the board parameter line calls getvalidmoves(to get list of xy coordinates with all the legal moves the player could make the board copy is marked with periods in those spaces and returned def getvalidmoves(boardtile) returns list of [ ,ylists of valid moves for the given player on the given board validmoves [ for in range( ) for in range( ) if isvalidmove(boardtilexy!false validmoves append([xy] return validmoves the getvalidmoves(function returns list of two-item lists these lists hold the xy coordinates for all valid moves for tile' player for the board data structure in the board parameter this function uses nested loops (on lines and to check every xy coordinate (all sixty four of themby calling isvalidmove(on that space and checking if it returns false or list of possible moves (in which case it is valid moveeach valid xy coordinate is appended to the list in validmoves