Skip to content

This project is to calculate the winning hand (combination) in the game of Poker.

Notifications You must be signed in to change notification settings

myoomotwani/Poker-Hand-Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

Poker Game

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

image

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.

Poker Hands

  1. Royal flush A, K, Q, J, 10, all the same suit.

1 royal flush

  1. Straight flush Five cards in a sequence, all in the same suit.

2 straight flush

  1. Four of a kind All four cards of the same rank.

3 Four of a kind

  1. Full house Three of a kind with a pair.

4 Full House

  1. Flush Any five cards of the same suit, but not in a sequence.

5 Flush

  1. Straight Five cards in a sequence, but not of the same suit.

6 Straight

  1. Three of a kind Three cards of the same rank.

7 Three of a kind

  1. Two pair Two different pairs.

8 Two Pairs

  1. Pair Two cards of the same rank.

9 Pair

  1. 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.

10 High card

Project scope

  • 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

Classes and project structure

  • 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.

How to run

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.

Roadmap

  • Cover remaining hand types.
  • Add JUnit test cases.

About

This project is to calculate the winning hand (combination) in the game of Poker.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages