예제 #1
0
 def run_game(self):
     while self.winner is None:
         self.stat_step_count += 1
         self.run_step()
         if (self.stat_step_count % 1 == 0) or (self.stat_step_count == 1):
             self.stat_card_count = []
             for player in self.players:
                 self.stat_card_count.append(player.get_total_card_count())
         if self.stat_step_count == 1000000:
             break
     if VERBOSE:
         clear()
         if self.winner is None:
             print 'Nobody wins!', str(
                 self.stat_step_count) + ':', self.stat_card_count
         else:
             print self.winner.name, 'wins the game!'
         print '  ' + 'Games: ' + str(self.stat_step_count)
         print '  ' + 'Cards: ' + str(self.stat_card_count)
         print '  ' + 'Wins : ' + str(self.stat_wins)
         print '  ' + 'Wars : ' + str(self.stat_wars)
         print '  ' + 'WarsW: ' + str(self.stat_wars_won)
         print '  ' + 'WCard: ' + str(self.stat_winning_card[-1])
         cards_by_value = [
             self.stat_winning_card[x][1:]
             for x in range(len(self.stat_winning_card))
         ]
         value_frequency = Counter(cards_by_value)
         print '  ' + 'Freq : ' + str(value_frequency)
         print ''
         time.sleep(0.1)
예제 #2
0
파일: war.py 프로젝트: skrzym/war-card-sim
 def run_game(self):
     while self.winner is None:
         self.stat_step_count += 1
         self.run_step()
         if (self.stat_step_count % 1 == 0) or (self.stat_step_count == 1):
             self.stat_card_count = []
             for player in self.players:
                 self.stat_card_count.append(player.get_total_card_count())
         if self.stat_step_count == 1000000:
             break
     if VERBOSE:
         clear()
         if self.winner is None:
             print 'Nobody wins!', str(self.stat_step_count) + ':', self.stat_card_count
         else:
             print self.winner.name, 'wins the game!'
         print '  ' + 'Games: ' + str(self.stat_step_count)
         print '  ' + 'Cards: ' + str(self.stat_card_count)
         print '  ' + 'Wins : ' + str(self.stat_wins)
         print '  ' + 'Wars : ' + str(self.stat_wars)
         print '  ' + 'WarsW: ' + str(self.stat_wars_won)
         print '  ' + 'WCard: ' + str(self.stat_winning_card[-1])
         cards_by_value = [self.stat_winning_card[x][1:] for x in range(len(self.stat_winning_card))]
         value_frequency = Counter(cards_by_value)
         print '  ' + 'Freq : ' + str(value_frequency)
         print ''
         time.sleep(0.1)
예제 #3
0
 def check_for_winner(self):
     for player in self.players:
         # print player.get_card_count()
         if player.get_total_card_count() == 52:
             self.winner = player
예제 #4
0
파일: war.py 프로젝트: skrzym/war-card-sim
 def check_for_winner(self):
     for player in self.players:
         # print player.get_card_count()
         if player.get_total_card_count() == 52:
             self.winner = player