def choose_move(self, state: CatanState): best_move = self.montecarlo.get_best_move(state) if best_move is not None: return best_move else: logger.warning('returning a random move') return RandomPlayer.choose_move(self, state)
def choose_move(self, state: CatanState): self.expectimax_alpha_beta.start_turn_timer() best_move, move, depth = None, None, 1 while not self.expectimax_alpha_beta.ran_out_of_time: best_move = move logger.info('starting depth {}'.format(depth)) move = self.expectimax_alpha_beta.get_best_move(state, max_depth=depth) depth += 2 if best_move is not None: return best_move else: logger.warning('did not finish depth 1, returning a random move') return RandomPlayer.choose_move(self, state)