def test_get_random_action(self):
        not_expected = Action.get_random_action()

        result = Action.get_random_action()
        while not_expected == result:
            result = Action.get_random_action()

        self.assertNotEqual(not_expected, result)
示例#2
0
    def create_next_action(self, game: Game, return_value: Value):
        """See base class."""
        self._turn_ctr += 1

        root = SearchTreeRoot(game.copy())
        player_ids_to_watch = game.get_other_player_ids(
            self.player, self.__distance_to_check, True)
        combinations = Action.get_combinations(len(player_ids_to_watch))

        action = root.calculate_action(self.player, player_ids_to_watch,
                                       combinations, self.__depth,
                                       self._turn_ctr, True, [],
                                       self._max_speed, self.__randomize)
        return_value.value = (action if action is not None else
                              Action.get_random_action()).get_index()
示例#3
0
 def create_next_action(self, game: Game, return_value: Value):
     """See base class."""
     self._turn_ctr += 1
     action = Action.get_random_action()
     return_value.value = action.get_index()
示例#4
0
 def create_next_action(self, game: Game, return_value: Value):
     """See base class."""
     self._turn_ctr += 1
     actions = self.create_next_actions_ranked(game)
     action = actions[0][0] if actions is not None and len(actions) > 0 else Action.get_random_action()
     return_value.value = action.get_index()