Skip to content

Davideck123/joker-calc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🃏 JOKER - Java pOKER Calculator

Javadoc

Joker calculator is a 7-card Texas Hold'em poker odds calculator and evaluator.
The evaluator is a Java port of PokerHandEvaluator by HenryRLee, which contains a detailed explanation of the hand evaluation algorithm. The calculator then evaluates all combinations of cards that are left in the deck, and calculates the probability of each player winning/splitting.

Build

To use the joker calculator from the command line, simply run mvn clean package to build the jar and then you can use the ./joker command in the top level directory.

Usage

Cards are specified as card aliases (two character strings), where the first character is the rank 2, 3, 4, 5, 6, 7, 8, 9, T, J, Q, K, A and the second character is the suit c, d, h, s for clubs, diamonds, hearts and spades respectively.

Specify the players' cards as space seperated card aliases, e.g. Ah 4d for A♥️ (Ace of Hearts) and 4♦️ (Four of Diamonds), 2c Ts for 2♣️ (Deuce of Clubs) and 10♠️ (Ten of Spades), etc.

Optionally specify the board cards as space seperated card aliases, e.g. -b 2c Ts 4d 5h for 2♣️ (Deuce of Clubs), 10♠️ (Ten of Spades), 4♦️ (Four of Diamonds) and 5♥️ (Five of Hearts) as the turn etc.

Optionally specify the dead cards (the cards that are no longer in the deck) as space seperated card aliases, e.g. -d Tc 2c for 10♣️ (Ten of Clubs) and 2♣️ (Deuce of Clubs).

./joker -h
Usage: joker [-ehV] [-b=<card>]... [-d=<card>]... (<card> <card>)...
      (<card> <card>)...   Player cards (2 cards per player, 2 to 10 players).
  -b, --board=<card>       Board cards - flop, turn or river (3 to 5 cards).
  -d, --dead=<card>        Cards that are no longer in the deck (1 to 19 cards).
  -e, --emoji              Display emojis for suits instead of letters.
  -h, --help               Show this help message and exit.
  -V, --version            Print version information and exit.

Also, you can use the -e flag to display emojis for suits instead of letters.

./joker Jh 9s Ac 2d -e
          Win     Tie
J♥️9♠️:  43.82%   0.43%
A♣️2♦️:  55.75%   0.43%

Examples

Player 1 has A♥️ (Ace of Hearts) and K️♥️ (King of Hearts),
player 2 has Q♣️ (Queen of Clubs) and Q♦️ (Queen of Diamonds),
player 3 has 7♣️ (Seven of Clubs) and 7♦️ (Seven of Diamonds)
and the board is 3♦️ (Three of Diamonds), 5♣️ (Five of Clubs) and K♣️ (King of Clubs).
The scenario is represented as follows: Ah Kh Qc Qd 7c 7d -b 3d 5c Kc

./joker Ah Kh Qc Qd 7c 7d -b 3d 5c Kc
        Win     Tie
AhKh:  76.41%   0.00%
QcQd:  13.18%   0.00%
7c7d:  10.41%   0.00%

Player 1 has A♣️ (Ace of Clubs) and 8♠️ (Eight of Spades),
player 2 has 5♣️ (Five of Clubs) and 8♥️ (Eight of Hearts),
player 3 has 7♦️ (Seven of Diamonds) and K♦️ (King of Diamonds)
and the dead cards are K♥️ (King of Hearts) and 2♣️ (Deuce of Clubs).
The scenario is represented as follows: Ac 8s 5c 8h 7d Kd -d Kh 2c

./joker Ac 8s 5c 8h 7d Kd -d Kh 2c
        Win     Tie
Ac8s:  45.69%   2.22%
5c8h:  16.90%   2.22%
7dKd:  35.20%   0.29%

API docs

Javadoc available HERE

Resources

Some interesting resources I found while studying the poker hand evaluation algorithms:
PokerHandEvaluator/Algorithm.md - The hand evaluation algorithm used in this project with super detailed explanation
Enumerating Five-Card Poker Hands
Cactus Kev's Poker Hand Evaluator
The Great Poker Hand Evaluator Roundup

Some GUI-based evaluators I used to check the odds:
Poker Master Tool (Github)
Texas Hold'em Odds Calculator

Other poker evaluators:
PokerHandEvaluator
TwoPlusTwoHandEvaluator
SKPokerEval
OMPEval
Java 5-card evaluator
Collection of poker evaluators