Monte Carlo simulator for Texas Hold'em that can simulate each player probability of winning.
The simulation can proceed for any number of known and unknown cards, for example we can run a 10000 trajectory simulation of a 3 player game, where:
- We know that the first player has Ace of Hear, and Ten of Diamond
- The second player we only know that they hold the Ace of Diamond and one unknown card
- For the third player we know neither of the two cards.
- In terms of community cards we only know the flop is King of Diamond, Queen of Diamond, and Jack of Spade
example :: IO ()
example = do
let game = Game
{
players =
[
Player (Just $ newCard Ace Heart) (Just $ newCard Ten Diamond )
, Player (Just $ newCard Ace Diamond) Nothing
, Player Nothing Nothing
]
, flop = Just (Flop (newCard King Diamond) (newCard Queen Diamond) (newCard Jack Spade))
, turn = Nothing
, street = Nothing
}
probabilities <- simulate game 10000
print probabilities
Then run example
in ghci
λ> example
[0.7717,0.1831,4.52e-2]
λ>
Contains an implementation of an efficient poker hand evaluation based on the work of Henry Lee which you can find at PokerHandEvaluator
The implementation is relatively efficient and can evaluate all possible 133,784,560 possible poker hands in less than 10 seconds.