def test_everyone_agree_logic_regression(self):
        players = [Player("uuid%d" % i, 100) for i in range(4)]
        players[0].stack = 150
        players[1].stack = 150
        players[2].stack = 50
        players[3].stack = 50
        deck = Deck(cheat=True, cheat_card_ids=range(1, 53))
        table = Table(cheat_deck=deck)
        for player in players:
            table.seats.sitdown(player)
        table.dealer_btn = 3
        table.set_blind_pos(0, 1)

        state, _ = RoundManager.start_new_round(1, 5, 0, table)
        state, _ = RoundManager.apply_action(state, "raise", 15)
        state, _ = RoundManager.apply_action(state, "raise", 20)
        state, _ = RoundManager.apply_action(state, "raise", 25)
        state, _ = RoundManager.apply_action(state, "raise", 30)
        state, _ = RoundManager.apply_action(state, "raise", 50)
        state, _ = RoundManager.apply_action(state, "call", 50)
        state, _ = RoundManager.apply_action(state, "raise", 125)
        state, _ = RoundManager.apply_action(state, "call", 125)
        state, _ = RoundManager.apply_action(state, "fold", 0)
        state, _ = RoundManager.apply_action(state, "fold", 0)
        self.eq(Const.Street.FINISHED, state["street"])
 def __setup_table(self):
   players = [Player("uuid%d" % i, 100) for i in range(3)]
   deck = Deck(cheat=True, cheat_card_ids=range(1,53))
   table = Table(cheat_deck=deck)
   for player in players: table.seats.sitdown(player)
   table.dealer_btn = 2
   table.set_blind_pos(0, 1)
   return table
示例#3
0
def _restore_table(round_state):
    table = Table()
    table.dealer_btn = round_state["dealer_btn"]
    table.set_blind_pos(round_state["small_blind_pos"], round_state["big_blind_pos"])
    _restore_community_card_on_table(table, round_state["community_card"])
    table.deck = _restore_deck(round_state["community_card"])
    table.seats = _restore_seats(round_state["seats"], round_state["action_histories"])
    return table
示例#4
0
 def __setup_table(self):
     players = [Player("uuid%d" % i, 100) for i in range(3)]
     deck = Deck(cheat=True, cheat_card_ids=range(1, 53))
     table = Table(cheat_deck=deck)
     for player in players: table.seats.sitdown(player)
     table.dealer_btn = 2
     table.set_blind_pos(0, 1)
     return table
def _restore_table(round_state):
    table = Table()
    table.dealer_btn = round_state['dealer_btn']
    table.set_blind_pos(round_state['small_blind_pos'],
                        round_state['big_blind_pos'])
    _restore_community_card_on_table(table, round_state['community_card'])
    table.deck = _restore_deck(round_state['community_card'])
    table.seats = _restore_seats(round_state['seats'],
                                 round_state['action_histories'])
    return table
示例#6
0
    def generate_initial_game_state(self, players_info):
        table = Table()
        for uuid, info in players_info.items():
            table.seats.sitdown(Player(uuid, info["stack"], info["name"]))

        table.dealer_btn = len(table.seats.players) - 1
        return {
            "round_count": 0,
            "small_blind_amount": self.game_rule["sb_amount"],
            "street": Const.Street.PREFLOP,
            "next_player": None,
            "table": table
        }
def setup_table():
    table = Table()
    players = [Player("uuid%d"%i, 100, "hoge") for i in range(3)]
    table.seats.players = players
    table.add_community_card(Card.from_id(1))
    table.dealer_btn = 2
    table.set_blind_pos(2, 0)
    p1, p2, p3 = table.seats.players
    p3.add_action_history(Const.Action.RAISE, 10, 5)
    p1.add_action_history(Const.Action.FOLD)
    p2.add_action_history(Const.Action.RAISE, 20, 10)
    p3.add_action_history(Const.Action.CALL, 20)
    [p.save_street_action_histories(Const.Street.PREFLOP) for p in [p1, p2, p3]]
    p3.add_action_history(Const.Action.CALL, 5)
    p2.add_action_history(Const.Action.RAISE, 5, 5)
    return table
示例#8
0
def setup_table():
    table = Table()
    players = [Player("uuid%d" % i, 100, "hoge") for i in range(3)]
    table.seats.players = players
    table.add_community_card(Card.from_id(1))
    table.dealer_btn = 2
    table.set_blind_pos(2, 0)
    p1, p2, p3 = table.seats.players
    p3.add_action_history(Const.Action.RAISE, 10, 5)
    p1.add_action_history(Const.Action.FOLD)
    p2.add_action_history(Const.Action.RAISE, 20, 10)
    p3.add_action_history(Const.Action.CALL, 20)
    [
        p.save_street_action_histories(Const.Street.PREFLOP)
        for p in [p1, p2, p3]
    ]
    p3.add_action_history(Const.Action.CALL, 5)
    p2.add_action_history(Const.Action.RAISE, 5, 5)
    return table
  def test_everyone_agree_logic_regression(self):
    players = [Player("uuid%d" % i, 100) for i in range(4)]
    players[0].stack = 150
    players[1].stack = 150
    players[2].stack = 50
    players[3].stack = 50
    deck = Deck(cheat=True, cheat_card_ids=range(1,53))
    table = Table(cheat_deck=deck)
    for player in players: table.seats.sitdown(player)
    table.dealer_btn = 3
    table.set_blind_pos(0, 1)

    state, _ = RoundManager.start_new_round(1, 5, 0, table)
    state, _ = RoundManager.apply_action(state, "raise", 15)
    state, _ = RoundManager.apply_action(state, "raise", 20)
    state, _ = RoundManager.apply_action(state, "raise", 25)
    state, _ = RoundManager.apply_action(state, "raise", 30)
    state, _ = RoundManager.apply_action(state, "raise", 50)
    state, _ = RoundManager.apply_action(state, "call", 50)
    state, _ = RoundManager.apply_action(state, "raise", 125)
    state, _ = RoundManager.apply_action(state, "call", 125)
    state, _ = RoundManager.apply_action(state, "fold", 0)
    state, _ = RoundManager.apply_action(state, "fold", 0)
    self.eq(Const.Street.FINISHED, state["street"])