CS246 Final Project Option:  Multiplayer Texas Hold 'em

Presentation And Working Skeleton Due: Apr 28, 2016
Final Version due: Friday, May 6, 2016 11:59pm

This project is in lieu of selecting your own project. If you have not yet sent me a project proposal. You are expected to do this project. Your job is to implement a multiplayer version of the Texas Hold 'em Poker card game. This will be a group project. Please send me a list of your group and each member's responsibilities as soon as possible.

Rules for Texas Hold 'em can be found at the bottom of this page. The relative strengths of the different hands in Poker can be found below that.

There are three major components and an optional 4th GUI component to this project:

  1. Server:
  2. Client:
  3. Hand analyser / Bet manager
  4. Optional GUI.

All server/client communications will be done through world readable text files, or optionally shared memory structures (Note: this option is very challenging). The exact format of these files should be of your own design, to reflect your own design for your data structures, etc. Caution: depending on your design, you may have problems unless you have some mechanism to manage synchronization (what happens if the client tries to read the file before the server finishes writing to it). Because the files are world readable, you can assume that there is no cheating.

There will be a required 10-min demo of your finished project.

Rules:

In Texas Hold 'em, each player is dealt two cards. One player acts as dealer, and the player to his immediate left is called the small blind, and the to the small blind's immediate left is called the big blind. The big blind places a bet of some fixed amount, and the small blind places a bet of half that amount. Note: after each completed hand, dealership rotates to the left.

Then the rest of the players have the option to call [match] the big blind's bet amount, or raise the amount bet, or fold [forfeit all chance of winning the pot but refrain from putting more money in]. After a player has raised the bet, the other players must then call that bet, raise it, or fold. The small blind must complete his bet (or raise or fold) when the betting gets around to him, and then the big blind has the option to raise or check [put no more money in the pot but stay in the hand] if nobody has raised yet. Note: In this game, while the minimum raise is the size of the big blind, there is no maximum bet, except for the money that the player betting has.

After the first round of betting, three community cards are placed in the in the middle, and betting proceeds again with the small blind being the first to have the option of placing a bet. These cards are used by everyone to have a chance of making the best possible hand. After this round of betting, there is a fourth card placed in the middle and there is another round of betting. Finally, a fifth card is placed in the middle, and after one last round of betting, those players who have not yet folded compare their hands, and the person with the highest hand wins. Players who fold or are the last player remaining in a hand where everyone else has folded do not have to show their cards. Also the person who has raised the bet is obligated to show his cards, but players who have called, upon seeing that the person who has raised has a better hand, may optionally not show his cards. Note: if you don't show in this situation, it is equivalent to folding. This option is used for ego purposes or for hiding a player's history of strategy. Also note that all showing would be done AFTER the hand, not during, no matter what the player does.

Note that each player is using seven total cards to try to make the best possible five card poker hand. Each player chooses which 5 cards make the best poker hand, and the other two cards are ignored for the purposes of determining who has the best hand.

Finally, betting for players who have "gone all-in" (bet all their money on one hand) do not have to call subsequent bets. If multiple other players remain in the hand, all subsequent raises are put into a side pot on which of the remaining players has the next strongest hand, and the money that is in that side pot is ineligible to be won by the player who has gone all-in. That player can only win as much from any one player as he or she had to begin the hand with.

Note: the strength of cards is as follows: Ace, King, Queen, Jack, 10-2 in that order. Also note that fully-fledged ties are broken by splittting the pot into even pieces for each player in the tie.

The poker hand relative strengths are, in ascending strength:

    High card. If the player has none of the hands below, their cards are weighted according to their individual strength. Ties are broken by each player's next highest card (called "kickers").

    Single pair of cards. If two player have the same pair, ties are broken by the kickers that the two players have.

    Two pairs of cards. Again, if two player have the same two pair, ties are broken by the kicker card.

    Three of a kind (three of any one card).

    Straight. This means a sequence of 5 cards in order (like 8,9,10,J,Q). The ace is considered either high (above the king) or low (below the two) for the purposes of determining whether a player has a straight, but if it is counted low then the player has a 5-high straight.

    Flush. This means having five cards of the same suit. Flushes are compared the same way high-card hands are compared, except obviously only cards which are in that suit are compared.

    Full house. This means that the player has both a three of a kind AND their remaining two cards are also a pair. When comparing two full houses, compare the three of a kind first, and the pair should only be considered to break ties.

    Four of a kind. If any player has all four of one type of card, they have a four of a kind. In the unlikely event that two players have the same four of a kind (the four of a kind is in the middle), the player with the highest kicker wins.

    Straight flush. This very unlikely hand has 5 cards that are both a straight and a flush.

    Royal straight flush. This is just a special name given to an Ace-high straight flush because it is so rare (there are only 4 possible royal straight flushes out of a possible 50^5 - approximately - number of hands).