Poker is a card game in which players bet over which hand is best according to the game's rules.
Cards are dealt in a phased manner. Here are the stages
- Hole cards - Each player (who are still in the round) gets dealt 2 cards.
- Flop - 3 card are placed in the center.
- Turn - 1 more card is placed in center.
- River - 1 more card is placed in center.
- Show
Before each stage , any of the players can bet more or raise the bet. In order to remain in the round , other players need to match the amount .i.e "Call" , or "Raise" it furthure. If they dont want to match the amount , they can "fold" the cards and stay out for that round.
All the money collected as part of bets goes to a "pot".
After "show" , best hands (best combination) for each player , who are still in the round, is determined .
Hand for a player is decided among best 5 out of the 7 cards for the player.
7 cards = 2 hole + 5 community cards
= 2 hole + 3 flop + 1 turn + 1 river
The player with the best hand wins the pot.And the winner takes it all.
- Royal flush A, K, Q, J, 10, all the same suit.
- Straight flush Five cards in a sequence, all in the same suit.
- Four of a kind All four cards of the same rank.
- Full house Three of a kind with a pair.
- Flush Any five cards of the same suit, but not in a sequence.
- Straight Five cards in a sequence, but not of the same suit.
- Three of a kind Three cards of the same rank.
- Two pair Two different pairs.
- Pair Two cards of the same rank.
- High Card When you haven't made any of the hands above, the highest card plays. In the example below, the jack plays as the highest card.
- This project only focuses on calculating best hand for players.
- It does not take care of betting system in poker.
- Concept of Dealer player , big blind , small blind are not relevant to this project.
As of now below combinations are covered to be checked
- Royal Flush
- Stright Flush
- Straight
- Flush
- Card class to represent a card in the deck
- Combination class to represent a hand enum and related info
- Suite enum
- Dealer represents an entity that deals cards accordingly. it is not the dealer which is the player.
- combinationfinder package - various combination finders are packed in one folder.
There are 2 flavors to run this program
-
Actual game play : In this flavor , Dealer class generates a pack of 52 cards. Shuffles cards using random generator. Then deals cards accordingly. For each of the players , winning hand is then determined. Run PokerGamePlayDemo class to use this mode.
-
Hard coded cards : In this flavor , we can hard code the cards and test the program against those cards. This is useful while testing as in dealer based approach we don't have control over which cards will be dealt. Run TestHandDemo class to use this mode. Use HardCodedDealer to change the cards.
- Cover remaining hand types.
- Add JUnit test cases.