예제 #1
0
            if debug:
                print "Now bs call at stage ", stage
            next = self.status.call()
            action = "Call"
        else:
            next = self.status.praise()
            if debug:
                print "Now bs bet/raise at stage ", stage
            action = "Raise"
        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


if __name__ == "__main__":
    import pickle
    #    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.Auto_player(net, name="superbot")
    bs = Betting_station()
    auto.train(10, bs, debug=1)
    pickle.dump(auto, open("player.p", "wb"))
예제 #2
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

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.Auto_player(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.Auto_player(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)
예제 #3
0
import tight_aggressive
import framework
import numpy as np
import calling_station

csbot = calling_station.Calling_station()
preflop_net = UnbiasedNet.NeuralNet(framework.n_in,
                                    framework.n_hidden,
                                    framework.n_out,
                                    alpha=0.001,
                                    lamb=0.9,
                                    randomInit=False,
                                    momentum=0,
                                    subdiv=[(0, 0), (52, framework.n_hidden),
                                            (framework.n_in,
                                             framework.n_hidden)])

preflop_bot = framework.Auto_player(preflop_net, name="preflop_bot")
bots = [preflop_bot]
for bot in bots:
    bot.train(100000, csbot, frenzy=True)
    pickle.dump(bot, open(bot.name + ".p", "wb"))
for bot in bots:
    wins = []
    for i in range(10):
        wins.append(bot.compete(csbot, 1000, debug=0))
    print "name= ", bot.name
    print wins
    print 'mean', np.mean(wins)
    print 'std', np.std(wins)
예제 #4
0
        if debug:
            #print "after the decision is made at stage:", stage
            #print self.status.vec_act[stage]
            #print player2.status.vec_act[stage]
            print self.name + " decided to ", game_actions[index]
        return game_actions[index]


if __name__ == "__main__":
    net = UnbiasedNet.NeuralNet(framework.n_in,
                                framework.n_hidden,
                                framework.n_out,
                                alpha=0.1,
                                lamb=0.9,
                                randomInit=True)
    auto = framework.Auto_player(net, name="auto")

    auto2 = Specified_prob(prob_list={
        'Check': 1,
        'Call': 1,
        'Raise': 0.01,
        'CheckFold': 0.01
    })
    auto.train(1, auto2, debug=1)
    #   auto.compete(auto2)
    #create a raising bot, the number doesn't have to add up to be 1
    auto3 = Specified_prob(prob_list={
        'Check': 0.01,
        'Call': 0.1,
        'Raise': 0.99,
        'CheckFold': 0.01