Variants

There are two poker variants available:

  • 5-card Draw Poker
  • 5-card Stud Poker

Example

library(casino)

# Setup a new casino
setup(".paris")
#> No records found.
#> Storing player records at '.paris'
#> Updating value for environment variable 'CASINO_FILE'.

5-card Draw

x <- Poker$new(who = "Gritty", type = "draw", bet = 20)
#> You have no money!

# play one hand
x$play()
#> You bet 20; you have 80 left.
#>  Hand: 8 ♥, 3 ♥, 2 ♠, 6 ♦, 8 ♠
#> Choose cards to `hold()`` and then `draw()`.

x$hold(1, 2, 5)    # hold cards in positions {1, 2, 5}
#>  Hand: 8 ♥, 3 ♥, 2 ♠, 6 ♦, 8 ♠
#> Choose cards to `hold()`` and then `draw()`.

x$draw()           # draw new cards for positions {3, 4}
#>  Hand: 8 ♥, 3 ♥, 8 ♠, J ♣, 6 ♥
#>  Result: one pair
#>    You lost -20!
#>    Now you have 80 in your account.
#> Do you want to `play()` again?

5-card Stud


x <- Poker$new(who = "Gritty", type = "stud", bet = 10)
#> Loading player profile...

# play one hand
x$play()
#> You bet 10; you have 70 left.
#>  Hand: 2 ♦, 3 ♦, A ♠, 3 ♥, K ♦
#>  Result: one pair
#>    You lost -10!
#>    Now you have 70 in your account.
#> Do you want to `play()` again?

# play 2 hands back-to-back
x$play()$play(bet = 5)
#> You bet 10; you have 60 left.
#>  Hand: 10 ♦, J ♣, J ♠, Q ♠, 9 ♣
#>  Result: one pair (jacks or better)
#>    You won 0!
#>    Now you have 70 in your account.
#> Do you want to `play()` again?
#> You bet 5; you have 65 left.
#>  Hand: A ♣, 5 ♣, 8 ♠, K ♣, 4 ♠
#>  Result: A high
#>    You lost -5!
#>    Now you have 65 in your account.
#> Do you want to `play()` again?

Payouts

outcome multiplier win
royal flush 800 4000
straight flush 200 1000
4-of-a-kind 25 125
full house 10 50
flush 7 35
straight 5 25
3-of-a-kind 3 15
two pair 2 10
one pair (jacks or better) 1 5