Docs Build | |
Documentation | |
GHA CI | |
Code Coverage | |
Bors enabled |
A package for simulating no-limit Texas Holdem Poker. Install with
(@v1.x) pkg> add TexasHoldem
A single game can be played with play!
or a tournament-style game with tournament!
:
using TexasHoldem
tournament!(configure_game()) # play until 1 player remains
Four methods (variants of player_option
) need to be defined to create and play your own bot:
using TexasHoldem
import TexasHoldem: player_option
struct MyBot <: AbstractStrategy end
function player_option(game::Game, player::Player{MyBot}, ::CheckRaiseFold)
# options:
rand() < 0.5 && return Raise(rand(valid_raise_range(game.table, player)))
return Check()
# return Fold() # we can fold, but we can check for free
end
function player_option(game::Game, player::Player{MyBot}, ::CallRaiseFold)
# options:
rand() < 0.5 && return Call(game.table, player)
rand() < 0.5 && return Raise(rand(valid_raise_range(game.table, player)))
return Fold()
end
function player_option(game::Game, player::Player{MyBot}, ::CallAllInFold)
# options:
rand() < 0.5 && return Call(game.table, player)
rand() < 0.5 && return AllIn(game.table, player)
return Fold()
end
function player_option(game::Game, player::Player{MyBot}, ::CallFold)
# options:
rand() < 0.5 && return Call()
return Fold()
end
# Heads-up against MyBot!
tournament!(Game((Player(Human(), 1), Player(MyBot(), 2))))
Package | Development status | Purpose |
---|---|---|
PlayingCards.jl | Perhaps stable | Representing cards |
PokerHandEvaluator.jl | Perhaps stable | Comparing any two 5-7 card hands |
TexasHoldem.jl | Likely changes needed | Simulating multi-player games of TexasHoldem |
PokerBots.jl | very early development | Battling bots with prescribed (or learned) strategies |
PokerGUI.jl | very early development | Visualizing TexasHoldem games via a GUI |