Skip to content

holdem engine written ~= disruptor pattern w/ring buffers

Notifications You must be signed in to change notification settings

jnorthrup/TexasEnum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TexasEnum as dubed on github is an experimental holdem hand evaluator.  

This code base started out as a test of Sam Pullara's Poker Engine http://www.javarants.com/2005/05/06/writing-a-web-based-poker-game-in-java/

performance related profiling revealed that removing heap objects from Sam's most elegant and simple java could increase throughput.

the result was something profoundly emulating c99 with enums, using java constructs.  clarity is not the high point of this strategy

below is a unit test transcript, which highlights the progress of a simple holdem contest and a loop timed benchmark.  
performed on a stock speed intel i980x 12-core running ubuntu 11.10

Oct 5, 2011 1:29:53 PM poker.game.GameState$1 update
INFO: shuffle 3h3c8c6cQs7s9s8sQhTsJc6hTcKh4sJs4h8d3s4c3d9hAh9c8h6sTd2hAd6d5c5dQd9d7dAcQc7hKs5sJdJh
Oct 5, 2011 1:29:53 PM poker.game.GameState dump
INFO: deal **** null:[name='ca5cfda7-9346-48c1-b772-eb612c533e93][PAIR:3h3c[name='7b0de251-8038-4c6a-b061-d46bb460372c][out=false, wins=0, stack=499.5, act=null, pocket=3h3c, shot=3h3c], HIGH:8c6c[name='8eeef256-061e-4e3c-ab4c-b380edf9d128][out=false, wins=0, stack=499.5, act=null, pocket=8c6c, shot=8c]]
Oct 5, 2011 1:29:53 PM poker.game.GameState dump
INFO: flop **** null:7s9s8s[name='ca5cfda7-9346-48c1-b772-eb612c533e93][HIGH:9s8s7s[name='7b0de251-8038-4c6a-b061-d46bb460372c][out=false, wins=0, stack=493.5, act=check, pocket=3h3c, shot=9s], HIGH:9s8s7s[name='8eeef256-061e-4e3c-ab4c-b380edf9d128][out=false, wins=0, stack=493.5, act=check, pocket=8c6c, shot=9s]]
Oct 5, 2011 1:29:53 PM poker.game.GameState dump
INFO: turn **** null:7s9s8sTs[name='ca5cfda7-9346-48c1-b772-eb612c533e93][HIGH:Ts9s8s7s[name='7b0de251-8038-4c6a-b061-d46bb460372c][out=false, wins=0, stack=488.5, act=check, pocket=3h3c, shot=Ts], HIGH:Ts9s8s7s[name='8eeef256-061e-4e3c-ab4c-b380edf9d128][out=false, wins=0, stack=488.5, act=check, pocket=8c6c, shot=Ts]]
Oct 5, 2011 1:29:53 PM poker.game.GameState dump
INFO: river **** null:7s9s8sTs6h[name='ca5cfda7-9346-48c1-b772-eb612c533e93][STRAIGHT:Ts9s8s7s6h[name='7b0de251-8038-4c6a-b061-d46bb460372c][out=false, wins=0, stack=478.5, act=check, pocket=3h3c, shot=Ts9s8s7s6h], STRAIGHT:Ts9s8s7s6h[name='8eeef256-061e-4e3c-ab4c-b380edf9d128][out=false, wins=0, stack=478.5, act=check, pocket=8c6c, shot=Ts9s8s7s6h]]
Oct 5, 2011 1:29:53 PM poker.game.GameState$19 update
INFO: collect winner: STRAIGHT:Ts9s8s7s6h[name='8eeef256-061e-4e3c-ab4c-b380edf9d128][out=false, wins=1, stack=528.5, act=check, pocket=8c6c, shot=Ts9s8s7s6h]
Oct 5, 2011 1:29:53 PM poker.game.GameStateTest test2PlayerGame
INFO: [card(TEN,CLUBS), card(KING,HEARTS), card(FOUR,SPADES), card(JACK,SPADES), card(FOUR,HEARTS), card(EIGHT,DIAMONDS), card(THREE,SPADES), card(FOUR,CLUBS), card(THREE,DIAMONDS), card(NINE,HEARTS), card(ACE,HEARTS), card(NINE,CLUBS), card(EIGHT,HEARTS), card(SIX,SPADES), card(TEN,DIAMONDS), card(TWO,HEARTS), card(ACE,DIAMONDS), card(SIX,DIAMONDS), card(FIVE,CLUBS), card(FIVE,DIAMONDS), card(QUEEN,DIAMONDS), card(NINE,DIAMONDS), card(SEVEN,DIAMONDS), card(ACE,CLUBS), card(QUEEN,CLUBS), card(SEVEN,HEARTS), card(KING,SPADES), card(FIVE,SPADES), card(JACK,DIAMONDS), card(JACK,HEARTS)]
Oct 5, 2011 1:29:57 PM poker.game.GameStateTest getGameSpeed
INFO: ITERATIONS (100000000)/ duration (4549)=  21982.854

21.9 million hands per second!

About

holdem engine written ~= disruptor pattern w/ring buffers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages