Exemple #1
0
 def test_legal_action_provide(self):
     self.INFO.street = GameInfo.PREFLOP
     self.INFO.sb_pos = 0
     d = Dealer()
     pot = Pot()
     pot.add(5); pot.add(10)  #
     players = [MockLegalActPlayer(1,"sb",100),MockLegalActPlayer(2,"bb",10)]
     players[0].set_ans(["FOLD:0","CALL:5","RAISE:15:15"])   # choose call
     players[1].set_ans(["FOLD:0","CALL:0", "RAISE:15:15"])
     d.ask_action(players, pot, [], [], range(2),self.INFO)
Exemple #2
0
 def test_min_raise(self):
     p = Pot()
     p.add(5) # sb
     p.add(10) # bb
     eq_(15, p.get_min_raise())
     p.add(15) # raise 15
     eq_(20 ,p.get_min_raise())
     p.add(15) # call 15
     eq_(20,p.get_min_raise())
     p.reset_bet()
     eq_(10, p.get_min_raise())
Exemple #3
0
 def test_correct_raise_up(self):
     """
     Regression test for raise amount back to $10 after $40
     """
     self.INFO.street = GameInfo.PREFLOP
     self.INFO.sb_pos = 0
     pot = Pot()
     pot.add(5);pot.add(10)
     d = Dealer()
     p1 = MockPlayer(1,"a",1000)
     p2 = MockPlayer(2,"b",1000)
     p3 = MockPlayer(3,"c",1000)
     players = [p1,p2,p3]
     p1.set_action(["RAISE:20","RAISE:35","RAISE:50"])
     p2.set_action(["RAISE:25","RAISE:40","FOLD:0"])
     p3.set_action(["RAISE:15","RAISE:30","RAISE:45","FOLD:0"])
     p1.D = True;p2.D = True;p3.D = True;
     d.ask_action(players, pot, [], [], [2,0,1],self.INFO)
     eq_(1000-105,p1.stack)
     eq_(1000-65,p2.stack)
     eq_(1000-15-30-45,p3.stack)
Exemple #4
0
 def test_correct_action(self):
     d = Dealer()
     player = BasePlayer(1,'a',100)
     pot = Pot()
     pot.add(5)  # sb
     pot.add(10)  # bb
     eq_('FOLD:0',d.correct_action(player, 'FOLD:10', pot, 10, 5))
     eq_('CALL:5',d.correct_action(player, 'CALL:5', pot, 10, 5))
     eq_('RAISE:15',d.correct_action(player, 'RAISE:15', pot, 10, 5))
     eq_('FOLD:0',d.correct_action(player, 'CALL:15', pot, 10, 5))
     eq_('FOLD:0',d.correct_action(player, 'RAISE:120', pot, 10, 0))
     pot.add(15)  # sb
     eq_('RAISE:20', d.correct_action(player, 'RAISE:20', pot, 20, 10))
     pot.add(20)  # bb
     eq_('CALL:10', d.correct_action(player, 'CALL:10',pot, 30, 20))
Exemple #5
0
 def test_legal_action(self):
     d = Dealer()
     player = BasePlayer(1,'a',100)
     pot = Pot()
     pot.add(5) # sb bet
     pot.add(10) # bb bet
     acts = d.get_legal_action(player, pot, 10, 5)
     ok_("FOLD:0" in acts)
     ok_("CALL:5" in acts)
     ok_("RAISE:15:15" in acts)
     pot.add(15) # sb bet
     acts = d.get_legal_action(player, pot, 20, 10)
     ok_("FOLD:0" in acts)
     ok_("CALL:10" in acts)
     ok_("RAISE:20:20" in acts)
     pot.add(20) # bb bet
     acts = d.get_legal_action(player, pot, 30, 20)
     ok_("FOLD:0" in acts)
     ok_("CALL:10" in acts)
     ok_("RAISE:25:25" in acts)