def validateMoveLocation(game_state, location): xy = TurtleMove.getColumnAndRow(location) x = convertColumnNumber( xy[0] ) #NOTE!!: This will be assigned 'invalid_range' if it is outside of range. This is done by the convert function y = xy[1] #Check if the location is on the board, if x == 'invalid_range': return False if 0 <= y > 8: return False #print("Move:", y, x) #Checks if the location is occupied already #return getChar(game_state, x + (8*(y -1))) == Constants.PIECE_NONE return game_state[y - 1][x - 1] == Constants.PIECE_NONE
def validateMoveLocation(token, location): xy = TurtleMove.getColumnAndRow(location) x = convertColumnNumber( xy[0] ) #NOTE!!: This will be assigned 'invalid_range' if it is outside of range. This is done by the convert function y = xy[1] #Check if the location is on the board, if x == 'invalid_range': return False if 0 <= y > 8: return False #Checks if the location is occupied already if 'N' != getChar(token, x + (8 * (y - 1))): #All of that math simply takes the number of x + a certain number of rows return False else: #If the location is on the board return True. return True