""" (oldBoard, oldPlayer, oldStepNbr) = state if depth >= self.maxMinMaxDepth or oldBoard.is_finished(): return True else: return False def evaluate(self, state): """The evaluate function must return an integer value representing the utility function of the board. """ (oldBoard, oldPlayer, oldStepNbr) = state return calculate_accurate_score(oldBoard, oldPlayer) def play(self, board, player, step, time_left): """This function is used to play a move according to the board, player and time left provided as input. It must return an action representing the move the player will perform. """ self.time_left = time_left self.maxMinMaxDepth = calculate_maxMinMaxDepth(step, time_left) newBoard = avalam.Board(board.get_percepts(player==avalam.PLAYER2)) state = (newBoard, player, step) return minimax.search(state, self) if __name__ == "__main__": avalam.agent_main(Agent())
return True else: return False def evaluate(self, state): """The evaluate function must return an integer value representing the utility function of the board. """ (oldBoard, oldPlayer, oldStepNbr) = state if oldBoard.get_score() < 0: return -1 elif oldBoard.get_score() > 0: return 1 else: return 0 def play(self, board, player, step, time_left): """This function is used to play a move according to the board, player and time left provided as input. It must return an action representing the move the player will perform. """ self.time_left = time_left newBoard = avalam.Board(board.get_percepts(player == avalam.PLAYER2)) state = (newBoard, player, step) return minimax.search(state, self) if __name__ == "__main__": avalam.agent_main(Agent())