コード例 #1
0
 def train(self, num_of_train, opponent, debug=0, frenzy=0, recover_rate=0):
     #recover_rate=1 means recovers from frenzy immediately
     #recover_rate=0 means it never recovers
     rate = 1 - recover_rate
     frenzy_degree = frenzy
     self.frenzy = frenzy
     self.sbb.frenzy = frenzy
     self.bbb.frenzy = frenzy
     game = holdem.Holdem(2, 4, 4, debug)
     for i in range(num_of_train):
         if np.random.rand() < frenzy_degree:
             self.frenzy = frenzy
             self.sbb.frenzy = frenzy
             self.bbb.frenzy = frenzy
         else:
             self.frenzy = 0
             self.sbb.frenzy = frenzy
             self.bbb.frenzy = frenzy
         frenzy_degree *= rate
         if i % 2 == 1:
             result = self.sbb.sim_one_hand(opponent, game, 1, debug=debug)
         else:
             result = self.bbb.sim_one_hand(opponent, game, 0, debug=debug)
         game.endRound()
         # print result[1]
         self.learn_one(result[0], result[1], self.status.dealer)
     self.frenzy = 0
     self.sbb.frenzy = 0
     self.bbb.frenzy = 0
     return
コード例 #2
0
 def compete(self, opponent, num_of_games=100, debug=1):
     self.frenzy=0
     start_cash=0
     game=holdem.Holdem(2, 4, 4, debug)
     for i in range(num_of_games):
         result=self.sim_one_hand(opponent, game, dealer=i%2, debug=debug)
         game.endRound()
         if debug:
             print "End of one hand. The winning is", result[1], "\n"
         start_cash= start_cash+ result[1]
     return start_cash
コード例 #3
0
 def train(self, num_of_train, opponent, debug=0, frenzy=0):
     self.frenzy = frenzy
     game = holdem.Holdem(2, 4, 4, debug)
     for i in range(num_of_train):
         result = self.sim_one_hand(opponent,
                                    game,
                                    dealer=i % 2,
                                    debug=debug)
         game.endRound()
         # print result[1]
         self.learn_one(result[0], result[1])
         self.status = StatStatus()
         opponent.status = StatStatus()
     self.frenzy = 0
コード例 #4
0
 def compete(self, opponent, num_of_games=100, debug=0):
     start_cash = 0
     game = holdem.Holdem(2, 4, 4, debug)
     for i in range(num_of_games):
         if i % 2 == 1:
             result = self.sbb.sim_one_hand(opponent,
                                            game,
                                            dealer=1,
                                            debug=debug)
         else:
             result = self.bbb.sim_one_hand(opponent,
                                            game,
                                            dealer=0,
                                            debug=debug)
         game.endRound()
         if debug:
             print "End of one hand. The winning is", result[1], "\n"
         start_cash += result[1]
     return start_cash
コード例 #5
0
 def train(self,num_of_train, opponent, debug=0, frenzy=0, 
           recover_rate=0):
     #recover_rate=1 means recovers from frenzy immediately
     #recover_rate=0 means it never recovers
     rate=1-recover_rate
     frenzy_degree=frenzy
     self.frenzy= frenzy
     game= holdem.Holdem(2, 4, 4, debug);
     for i in range(num_of_train):
         if np.random.rand() < frenzy_degree:
             self.frenzy=frenzy
         else:
             self.frenzy=0
         frenzy_degree *=rate
         result=self.sim_one_hand(opponent, game, dealer=i%2, debug=debug)
         game.endRound()
         # print result[1]
         self.learn_one(result[0], result[1])
     self.frenzy= 0