def set_rival_move(self, pos): """Update your info, given the new position of the rival. input: - pos: tuple, the new position of the rival. No output is expected """ MiniMaxPlayer.set_rival_move(self, pos)
def set_game_params(self, board): """Set the game parameters needed for this player. This function is called before the game starts. (See GameWrapper.py for more info where it is called) input: - board: np.array, a 2D matrix of the board. No output is expected. """ MiniMaxPlayer.set_game_params(self, board)
def __init__(self, game_time, penalty_score): MiniMaxPlayer.__init__(self, game_time, penalty_score) # keep the inheritance of the parent's (AbstractPlayer) __init__() # TODO: initialize more fields, if needed, and the AlphaBeta algorithm from SearchAlgos.py self.approach = Approach.AlphaBetaApproach self.alphabeta = AlphaBeta(utility=Player.utility, succ=Player.succ, perform_move=Player.perform_move, goal=Player.goal, heuristic_function=Player.heuristic_function)
def update_fruits(self, fruits_on_board_dict): """Update your info on the current fruits on board (if needed). input: - fruits_on_board_dict: dict of {pos: value} where 'pos' is a tuple describing the fruit's position on board, 'value' is the value of this fruit. No output is expected. """ # TODO: erase the following line and implement this function. In case you choose not to use this function, # use 'pass' instead of the following line. MiniMaxPlayer.update_fruits(self, fruits_on_board_dict)
def make_move(self, time_limit, players_score): """Make move with this Player. input: - time_limit: float, time limit for a single turn. output: - direction: tuple, specifing the Player's movement, chosen from self.directions """ return MiniMaxPlayer.make_move_with_given_approach(self, time_limit=time_limit, players_score=players_score, approach=self.approach, search_object=self.alphabeta)
def perform_move(self): MiniMaxPlayer.perform_move(self)
def heuristic_function(self): return MiniMaxPlayer.heuristic_function(self)
def utility(self, maximizing_player): return MiniMaxPlayer.utility(self, maximizing_player)
def goal(self): return MiniMaxPlayer.goal(self)