Java SE implemention for Texas Hold'em Poker
OTHER License
It's fully functional core engine implentation of Texas Hold'em Poker.
GameTexasHoldem game = new GameTexasHoldem();
IPlayer homer = new Player();
IPlayer flanders = new Player();
IDeck deck = new Deck();
// The Deck and Player used in the GameTexasHoldem are interfaces..
// The newGame signature: public void newGame(IDeck deck, IPlayer player1, IPlayer... _players).
// At least one player is mandatory to start the game, but you can add as many players as you want (Java Varargs).
game.newGame(deck, homer, flanders);
game.deal();
game.callFlop();
game.betRiver();
game.betTurn();
List<IPlayer> winnerList = game.getWinner();
// Getting the result
if(winnerList.size() > 1){
// DRAW GAME
} else if(winnerList.contains(homer)) {
// HOMER WINNER
// WINNER HAND: homer.getRankingEnum();
} else if(winnerList.contains(flanders)) {
// FLANDERS WINNER
// WINNER HAND: flanders.getRankingEnum();
}
// The table cards
game.getTableCards();
// To get the player actual ranking
homer.getRankingEnum();
flanders.getRankingEnum();
// IPlayer.getRankingEnum() can be changed in deal, call flop, bet river and bet turn.
The IPlayer.getRankingEnum() method returns RankingEnum which contains the actual ranking of the player.
public enum RankingEnum { {
ROYAL_FLUSH,
STRAIGHT_FLUSH,
FOUR_OF_A_KIND,
FULL_HOUSE,
FLUSH,
STRAIGHT,
THREE_OF_A_KIND,
TWO_PAIR,
ONE_PAIR,
HIGH_CARD
}
GameTexasHoldemRunner.main() executes the performance test and outputs it in two CSV report files.
Example for 10000 executions
executions: 10000, minutes: 0, seconds: 1
getStatsSimple - OK - /Users/pablo/workspace/javapokertexasholdem/stats10000-simple.csv
getStatsFull - OK - /Users/pablo/workspace/javapokertexasholdem/stats10000-full.csv
Columns:
Columns: