Пример #1
0
 def __init__(self, game_time, penalty_score):
     AbstractPlayer.__init__(self, game_time, penalty_score) # keep the inheritance of the parent's (AbstractPlayer) __init__()
     self.board = None
     self.pos = None
     self.alphabeta = SearchAlgos.AlphaBeta(utility=self.utility, succ=self.succ, perform_move=None, goal=self.goal,
                                        heuristic=self.heuristic)
     self.players_score = None
Пример #2
0
 def __init__(self, game_time, penalty_score):
     AbstractPlayer.__init__(
         self, game_time, penalty_score
     )  # keep the inheritance of the parent's (AbstractPlayer) __init__()
     #TODO: initialize more fields, if needed, and the Minimax algorithm from SearchAlgos.py
     self.penalty_score = penalty_score
     self.name = "LightAlphaBeta"
     self.location = None
     self.game_board = None
     self.rival_location = None
     self.rival_points = 0
     self.points = 0
     self.time_ended = False
     self.start_time = 0
     self.fruit_locations = dict()
     self.fruit_life_time = None
     self.best_fruit_value = 0
     self.fruits_in_game = False
     self.best_fruit_location = None
     self.moves_available = []
     self.moves_available_count = 0
     self.rival_moves_available = []
     self.rival_moves_available_count = 0
     self.min_dimention = None
     self.fruits_concentration = None
     # self.init_concentration_dict()
     self.search_algos = SearchAlgos.AlphaBeta(self.utility, None,
                                               self.make_move, self.is_goal)
Пример #3
0
 def __init__(self, game_time, penalty_score):
     AbstractPlayer.__init__(
         self, game_time, penalty_score
     )  # keep the inheritance of the parent's (AbstractPlayer) __init__()
     self.alphaBeta = SearchAlgos.AlphaBeta(self.utility, self.succ,
                                            self.perform_move, self.goal,
                                            self.heuristic_function,
                                            self.revert_move)
Пример #4
0
 def __init__(self, game_time, penalty_score):
     AbstractPlayer.__init__(
         self, game_time, penalty_score
     )  # keep the inheritance of the parent's (AbstractPlayer) __init__()
     self.lifetime = 0
     self.board = None
     self.pos = None
     self.initial_pos = None
 def __init__(self, game_time, penalty_score):
     AbstractPlayer.__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.game_time = game_time
     self.penalty_score = penalty_score
     self.turn = 0
Пример #6
0
 def __init__(self, game_time, penalty_score):
     AbstractPlayer.__init__(
         self, game_time, penalty_score
     )  # keep the inheritance of the parent's (AbstractPlayer) __init__()
     # TODO: initialize more fields, if needed, and the Minimax algorithm from SearchAlgos.py
     self.lifetime = 0
     self.board = None
     self.pos = None
     self.initial_pos = None
Пример #7
0
 def __init__(self, game_time, penalty_score):
     # keep the inheritance of the parent's (AbstractPlayer) __init__()
     AbstractPlayer.__init__(self, game_time, penalty_score)
    
     self.penalty_score = penalty_score
     self.alphabeta = AlphaBeta(utility, succ, None, goal=is_goal_state)
     self.fruits_poses = None
     self.fruits_on_board_dict = {}
     self.locations = [None, None, None]
Пример #8
0
 def __init__(self, game_time, penalty_score):
     AbstractPlayer.__init__(self, game_time, penalty_score)
     self.board = None
     self.pos = None
     self.rival_pos = None
     self.fruits_on_board_dict = {}
     self.turns_till_fruit_gone = 0
     self.first_player = -1
     self.max_turns = 0
Пример #9
0
 def __init__(self, game_time, penalty_score):
     AbstractPlayer.__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.board = None  # player1 is my player
     self.pos_players = None  # tuple [0]-player1 pos, [1] -player2 pos
     self.strategy = sa.AlphaBeta(utility=self.utility, succ=utils.State.succ, retriveLast=utils.State.retriveLast,
                                goal=utils.State.goal)
     self.num_of_turns = (0, 0)  # tuple [0]-player1 turns, [1] -player2 turns
     self.fruits_on_board = None
     self.little_edge = 0
Пример #10
0
 def __init__(self, game_time, penalty_score):
     AbstractPlayer.__init__(
         self, game_time, penalty_score
     )  # keep the inheritance of the parent's (AbstractPlayer) __init__()
     self.lifetime = 0
     self.board = None
     self.pos = None
     self.A = None
     self.B = None
     self.C = None
     self.game_time = game_time
     self.fruit_disappear_turn = None
Пример #11
0
 def __init__(self, game_time, penalty_score):
     AbstractPlayer.__init__(
         self, game_time, penalty_score
     )  # keep the inheritance of the parent's (AbstractPlayer) __init__()
     self.board = None  # and add more fields to Player
     self.pos = None
     # map pressed key to direction on board
     self.keys_directions = {
         'a': self.directions[-1],
         'w': self.directions[0],
         'd': self.directions[1],
         's': self.directions[2]
     }
 def __init__(self, game_time, penalty_score):
     AbstractPlayer.__init__(
         self, game_time, penalty_score
     )  # keep the inheritance of the parent's (AbstractPlayer) __init__()
     # Might need to add here usage of minimax.
     self.max_fruit_turn = None
     self.penalty_score = penalty_score
     self.directions = utils.get_directions()
     # TODO: Remember update this
     self.current_turn = 0
     self.board = None
     self.pos = None
     self.minimax_algo = AlphaBeta(self.utility, self.succ, None)
 def __init__(self, game_time, penalty_score):
     AbstractPlayer.__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.lifetime = 0
     self.board = None
     self.pos = None
     self.A = None
     self.B = None
     self.C = None
     self.game_time = game_time
     self.fruit_disappear_turn = None
 def __init__(self, game_time, penalty_score):
     AbstractPlayer.__init__(
         self, game_time, penalty_score
     )  # keep the inheritance of the parent's (AbstractPlayer) __init__()
     # TODO: initialize more fields, if needed, and the Minimax algorithm from SearchAlgos.py
     # Might need to add here usage of minimax.
     self.max_fruit_turn = None
     self.penalty_score = penalty_score
     self.directions = utils.get_directions()
     # TODO: Remember update this
     self.current_turn = 0
     self.board = None
     self.pos = None
     self.minimax_algo = MiniMax(self.utility, self.succ, None)
 def __init__(self, game_time, penalty_score):
     AbstractPlayer.__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.game_time = game_time
     self.penalty_score = penalty_score
     self.turn = 0
     self.total_time = game_time
     self.time_left = game_time
     self.time_tmp = game_time
     self.ab = players.AlphabetaPlayer.Player(game_time, penalty_score)
     self.player = AlphaBeta(utility=self.ab.calc_score,
                             succ=self.ab.sorted_moves,
                             perform_move=self.ab.preform_move)
Пример #16
0
 def __init__(self, game_time, penalty_score):
     AbstractPlayer.__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.board = None
     self.pos = None
     self.flag = True
     self.time_frame = None
     self.global_time = game_time
     self.alphabeta = SearchAlgos.AlphaBeta(utility=self.utility,
                                            succ=self.succ,
                                            perform_move=None,
                                            goal=self.goal,
                                            heuristic=self.heuristic)
     self.players_score = None
Пример #17
0
 def __init__(self, game_time, penalty_score):
     AbstractPlayer.__init__(self, game_time, penalty_score)
     # TODO: initialize more fields, if needed, and the Minimax algorithm from SearchAlgos.py
     self.approach = Approach.MiniMaxApproach
     self.board = None
     self.pos = None
     self.rival_pos = None
     self.minimax = MiniMax(utility=GameState.utility,
                            succ=GameState.succ,
                            perform_move=Player.perform_move,
                            goal=GameState.goal,
                            heuristic_function=GameState.heuristic_function)
     self.fruits_dict = None
     self.cur_round = -1
     self.square_dict = {}  # key is square master pos ,val is square value
     self.points = None
Пример #18
0
    def __init__(self, game_time, penalty_score):
        AbstractPlayer.__init__(self, game_time, penalty_score)
        self.board = None
        self.pos = None
        self.rival_pos = None
        self.fruits_on_board_dict = {}
        self.turns_till_fruit_gone = 0
        self.first_player = -1
        self.max_turns = 0

        self.game_time = game_time  # more fields for this player
        self.time_for_curr_iter = 0
        self.time_for_each_iter = None
        self.my_turn = None
        self.extra_safe_time = 0.015
        self.risk_factor1 = 3
        self.risk_factor2 = 2.5
    def __init__(self, game_time, penalty_score):
        AbstractPlayer.__init__(
            self, game_time, penalty_score
        )  # keep the inheritance of the parent's (AbstractPlayer) __init__()
        # TODO: initialize more fields, if needed, and the wanted algorithm from SearchAlgos.py
        self.max_fruit_turn = None
        self.penalty_score = penalty_score
        self.directions = utils.get_directions()
        self.game_time = game_time
        self.turn_time = None
        # TODO: Remember update this
        self.current_turn = 0
        self.current_player_score = 0
        self.opponent_player_score = 0
        self.board = None
        self.pos = None
        self.minimax_algo = AlphaBeta(self.utility, self.succ, None,
                                      self.is_goal)
        self.initialized_fruits_already = False

        self.opponent_pos = None
        self.total_fruit_amount = None
Пример #20
0
 def __init__(self, game_time, penalty_score):
     AbstractPlayer.__init__(
         self, game_time, penalty_score
     )  # keep the inheritance of the parent's (AbstractPlayer) __init__()
Пример #21
0
 def __init__(self, game_time, penalty_score):
     AbstractPlayer.__init__(self, game_time, penalty_score)  # keep the inheritance of the parent's (AbstractPlayer) __init__()
     self.board = None             # and add two more fields to Player
     self.pos = None