Ejemplo n.º 1
0
    def get_action(self, state: GameState, connection):
        # TODO: Doc
        options = state.get_valid_actions()[:]
        for option in options:
            new_state = state.apply_action(option, self.other_type)
            is_term, winner = new_state.is_terminal()
            if is_term and winner > 0:
                return option

            new_state = state.apply_action(option, self.type)
            is_term, winner = new_state.is_terminal()
            if is_term and winner < 0:
                return option
        choice = random.choice(options)
        return choice
Ejemplo n.º 2
0
 def get_action(self, state: GameState, connection):
     # TODO: Doc
     options = state.get_valid_actions()
     choice = random.choice(options)
     return choice