Poker software architecture

I have some classes so far.

  • Hand stores information like SB, BB, ante, collection of Players
  • HandState inherits from class Hand. has members like phase {POSTING BLINDS, PREFLOP, FLOP, TURN, RIVER, SHOWDOWN }, pot. I consider every action in a poker hand as a handState. Players post ante (if any), Small blind and big blind posts blinds, the first player to act (UTG) calls the blind, the 2nd player (UTG+1) raises, etc…
  • Player members: name, position, list of actions so far, stack, etc…
  • Action members: type {FOLD,CALL, RAISE, RERAISE}, amount

The program receives as input the blinds, players, which player to act. Since the input I get is string (its a console program) I have to build the root handState.

After I have the root handState, I can build a gameTree where every node is a handState.
eg.:

stacks = "1000,2000,2300,1400,230";
actions = "200";
playerToAct = 2;
BB = 400;
SB = 200;

function makeRoot()
{
    stacks = makeArray(stacks)
    for(i=0; i < stacks.size; i++)
    {
        player = new Player;
        player.position =  "UTG"
        if (i > 0)
            player.position += i;
        if (i == stacks.size-2)
        {
            player.position = "SB";
            player.bet(SB);
        }
        if (i == stacks.size-1)
        {
            player.position = "BB";
            player.bet(BB);
        }
    }              
}

My problem that Player and HandState has no connection. What if player has not enough chips to pay the BigBlind (230<400)?
SB has enough chips, but if he bets 200, HandState’s pot wont know about it?
Should I keep track in both class?

//HandState
player.bet(200);
this.pot += 200;

//Player
bet(amount)
{
    this.stack -= amount;
    this.actions.push(new Action(amount, "BET"));
}

I hope there is some seasoned programmer with some poker knowledge to tell some opinion, critique my approach.

Your basic structure in poker is a table. If you have a tournament you have a collection of tables.

A table has a limited number of seats which are ordered in a sequence around the table.

Each seat can have a player, but a seat can be empty.

Before each hand is played the dealer is selected at the next non-empty seat going clockwise.

A player has a stack and hole cards (I’m assuming texas hold’em other variants require a different approach (ideally the approach should be injected into the player)).

The table also have a collection of pots. At the start of the hand there is one empty pot, as the bidding continue there may be added more pots.

Each pot contains a chip count and a list of players included in that pot.

At the start of each hand the blinds and antes are collected.

If a player does not have enough chips to pay the ante or the blinds a new pot is created (side pot).

Let us assume no ante and blinds of 200 and 400 chips.

The big blind is supposed to pay 400, but has only got 230 and goes all-in.

The first pot (the main pot) now contains 200 (small blind) and 230 (big blind) chips, and the players SB and BB. The pot also contains the information that the first 230 from players in this round of betting should go into this pot.

A new pot is created which 0 chips and the player SB.

To make this simple one player X calls 400. 230 chips and the player X is added to the first pot. 170 chips and the player X is added to the second pot.

The rest of the players fold as well as the small blind. When the small blind folds he is removed from the first pot.

We now have the first pot with (200+230+230) 660 chips and the players BB and X and we have the second pot with 170 chips and the player X.

As there is only one player in the last pot, there is no more bidding.

The flop, turn and river plays out and the winner is found.

As X is the only player in the second pot, that pot goes to player X.

The best hand of BB and X gets the first pot or it could even be split between the two players.

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật