Skip to content

A package for simulating multi-player no-limit texas holdem games

License

Notifications You must be signed in to change notification settings

charleskawczynski/TexasHoldem.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TexasHoldem.jl

Docs Build docs build
Documentation dev
GHA CI gha ci
Code Coverage codecov
Bors enabled bors

A package for simulating no-limit Texas Holdem Poker. Install with

(@v1.x) pkg> add TexasHoldem

Playing

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

Creating your own bot

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))))

Related packages

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

About

A package for simulating multi-player no-limit texas holdem games

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages