Exemple #1
0
    def rollout_one_battle(self, battlefield, turn_initialized):
        """
        Create a Battle from the client's battlefield, and run the game forward.
        If turn_initialized, then skip running Battle.init_turn for the next turn.
        """
        clone = deepcopy(battlefield)
        battle = Battle.from_battlefield(clone, *[RandomRolloutPolicy(i) for i in range(2)])

        if turn_initialized:
            battle.run_initialized_turn() # run the next turn without initializing it
        return battle.run_battle()        # complete the battle and return the winner
Exemple #2
0
 def get_critical_hit(crit_ratio):
     crit[0] = crit_ratio
     return Battle.get_critical_hit(crit_ratio)