def update_river(self, table): board = HandStat(table) self.vec_cards['river'] = board.stat( features=river_features, hole_cards=self.cards ) my = HandStat( self.cards + table ) self.vec_cards['my river'] = my.stat( features=my_river_features ) self.stage=3
def update_turn(self, table): board = HandStat(table) self.vec_cards['turn'] = board.stat( features=turn_features, hole_cards=self.cards ) my = HandStat( self.cards + table ) self.vec_cards['my turn'] = my.stat( features=my_postflop_features ) self.stage=2
def update_flop(self, table): #table is a list of Cards board = HandStat(table) self.vec_cards['flop'] = board.stat( features=flop_features, hole_cards=self.cards ) my = HandStat( self.cards + table ) self.vec_cards['my flop'] = my.stat( features=my_postflop_features ) self.stage=1
def __init__(self): self.net = UnbiasedNet.NeuralNet(fw.n_in, fw.n_hidden, fw.n_out, randomInit=False) self.status = fw.StatStatus() self.name = "CallingStation"
def update_river(self, table): board = HandStat(table) self.vec_cards['river'] = board.stat(features=river_features, hole_cards=self.cards) my = HandStat(self.cards + table) self.vec_cards['my river'] = my.stat(features=my_river_features) self.stage = 3
def update_turn(self, table): board = HandStat(table) self.vec_cards['turn'] = board.stat(features=turn_features, hole_cards=self.cards) my = HandStat(self.cards + table) self.vec_cards['my turn'] = my.stat(features=my_postflop_features) self.stage = 2
def update_flop(self, table): #table is a list of Cards board = HandStat(table) self.vec_cards['flop'] = board.stat(features=flop_features, hole_cards=self.cards) my = HandStat(self.cards + table) self.vec_cards['my flop'] = my.stat(features=my_postflop_features) self.stage = 1
def update_preflop(self, cards): self.cards = list(cards) # needed later hand = HandStat(cards=cards) self.vec_cards['my preflop'] = hand.stat(features=my_preflop_features)
next = self.status.check_fold() action = "CheckFold" self.status = next.copy() #update the other guy's status vector resulting from your act player2.status.vec_act[stage][1] = self.status.vec_act[stage][0] player2.status.vec_act[stage][2] = self.status.vec_act[stage][2] player2.status.stage = self.status.stage return action import pickle if 1: # auto= pickle.load(open("player.p", "rb")) net = UnbiasedNet.NeuralNet(fw.n_in, fw.n_hidden, fw.n_out, alpha=0.02, lamb=0.9, randomInit=True) auto = fw.MyAutoPlayer(net, name="superbot") cs = Calling_station() auto.train(50000, cs, debug=0) pickle.dump(auto, open("player2.p", "wb")) if 1: cs = Calling_station() auto = pickle.load(open("player2.p", "rb")) result = [] for i in range(40): result.append(auto.compete(cs, 5000, debug=0)) print result
def update_preflop(self, cards): self.cards = list(cards) # needed later hand = HandStat( cards=cards ) self.vec_cards['my preflop'] = hand.stat( features=my_preflop_features )
debug=debug) game.endRound() if debug: print "End of one hand. The winning is", result[1], "\n" start_cash += result[1] return start_cash if __name__ == "__main__": ALPHA = 0.0005 LAMB = 0.6 n_train = 10 net1 = UnbiasedNet.NeuralNet(fw.n_in, fw.n_hidden, fw.n_out, randomInit=True, alpha=ALPHA, lamb=LAMB) auto1 = fw.MyAutoPlayer(net1, name="auto1", frenzy=True) net2 = UnbiasedNet.NeuralNet(fw.n_in, fw.n_hidden, fw.n_out, randomInit=True, alpha=ALPHA, lamb=LAMB) auto2 = fw.MyAutoPlayer(net2, name="auto2", frenzy=True) big_small = Big_small_blind(auto1, auto2, frenzy=True) import calling_station csbot = calling_station.Calling_station() big_small.train(n_train, csbot, frenzy=True, debug=1) big_small.compete(csbot)