Skip to content

JavaTHoldem is a Texas Hold'em poker game written in Java.

Notifications You must be signed in to change notification settings

FredericFouche/JavaTHoldem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaTHoldem

JavaTHoldem is a Texas Hold'em poker game written in Java. It is a simple implementation of the game, using a console interface and ASCII art. It is a project for myself to learn Java and to practice programming.

Features

  • Play Texas Hold'em poker against computer players
  • Computer players have a simple AI that makes them play
  • The game is played in the console with ASCII art
  • The game is played with a deck of 52 cards
  • The game is played with 2 to 8 players

How to play

Soon


How to run

Soon


Technical details

I use Cactus Kev algorithm, translated to Java, to evaluate the strength of a hand.


Cactus Kev algorithm

The Cactus Kev algorithm is an algorithm to evaluate the strength of a hand in poker. It can be find here.

  1. The first step is to represent each card as a 32-bit integer. This integer is composed of 4 bit ranges to store attributes :

    Bit structure :
    [ Prime | Rank | Suit | Card ]
    
    Bits Meaning
    0-7 Unique prime number per each rank
    8-11 Rank (0 = 2, 12 = Ace)
    12-15 Suit (Clubs, Diamonds, Hearts, Spades)
    16-31 Bitmask with a single bit set at 16 + rank
  2. The second step is to evaluate the Hand strength.

    • First : Check for a flush using a bitmask.
    • Second : For non-flush hands, we use a Prime Product Algorithm to evaluate the hand strength.
    • Third : Once we have either : Bitmask for flush, Prime product for non-flush, we can look up the hand strength in 2 different precomputed tables, one for flushes and one for non-flushes.

To do

  • Implement the game methods
  • Implement the Cactus Kev algorithm
  • Implement Class for : Card, Deck, Hand, Player
  • Write tests for the classes
  • Clean up codebas
  • Refactor the code
  • Comment code with Javadoc
  • Game interface
  • Game logic
  • Implement the AI
  • Readme

About

JavaTHoldem is a Texas Hold'em poker game written in Java.

Topics

Resources

Stars

Watchers

Forks

Languages