コード例 #1
0
    def evaluate(self, player_1, player_2):
        """ 
        Play self.n_games Can't Stop games between player_1 and player_2. The
        players swap who is the first player per iteration because Can't Stop
        is biased towards the player who plays the first move.
        """

        victories = 0
        losses = 0
        draws = 0

        for i in range(self.n_games):
            game = Game(2, 4, 6, [2, 12], 2, 2)
            if i % 2 == 0:
                who_won = simplified_play_single_game(player_1, player_2, game,
                                                      self.max_game_rounds)
                if who_won == 1:
                    victories += 1
                elif who_won == 2:
                    losses += 1
                else:
                    draws += 1
            else:
                who_won = simplified_play_single_game(player_2, player_1, game,
                                                      self.max_game_rounds)
                if who_won == 2:
                    victories += 1
                elif who_won == 1:
                    losses += 1
                else:
                    draws += 1
        return victories, losses, draws
コード例 #2
0
 def evaluate_helper(self, args):
     return simplified_play_single_game(args[0], args[1], args[2], args[3])