#####################第一轮 def set_winner_1(self):#在第一局里面找冠军的第二个def players = self.get_players() for p in players: self.sum_bids = self.sum_bids + float(p.bid_1) if p.id_in_group == 1: p.other_bid = p.group.get_player_by_id(2).bid else: p.other_bid = p.group.get_player_by_id(1).bid # Key to remember if we already found a winner found_winner = 0 # Iterate the players and look for the winner for p in players: if self.sum_bids > 0: p.prob_win = round(float(p.bid_1) / self.sum_bids, 4) if self.sum_bids == 0: p.prob_win_1 = 0.5 if found_winner == 0: if p.group.rn_win <= p.prob_win: p.winning_streak = p.winning_streak +1 p.winner_battle_1 = 1 found_winner = found_winner + 1 else: p.other_bid.winner_battle_1 =1 found_winner = 1