The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
Welcome to the casino, we’ve got fun and games
We got everything you want and we know your name
We are a place where you can find whatever you may need
And if you got no money, don’t worry! You can play for “free”!
Play casino games in the R console!
Available games:
# Install development version from GitHub
::install_github("anthonypileggi/casino") devtools
Are you getting impatient already? Then use play()
to
get started immediately.
::play() casino
.casino
)All players must agree to our policies on recording activity. If you do not agree, you cannot play. House rules!
library(casino)
# create a local file for storing persisent player data
setup()
#> No records found.
#> Storing player records at '/Users/anthony/Documents/casino/.casino'
#> Updating value for environment variable 'CASINO_FILE'.
This allows us to store player information persistently between games and R sessions.
You can create a new player manually.
# Create a new player
$new(name = "Player 1")
Player#> You have no money!
#> Player:
#> Name: Player 1
#> Balance: 100
#> Level: 0
#> Played: 1
#> Debt: 100
# View all available player profiles
players()
#> # A tibble: 1 x 2
#> name balance
#> <chr> <chr>
#> 1 Player 1 100.000000
Or just start playing, and one will automatically be created for you.
# Start a new game (this will auto-create a player)
$new(who = "Player 2")
Blackjack#> You have no money!
#> Blackjack (w/ 1 decks):
#> Player: Player 2
#> Bank: 100
#> Start a new game with `play()`.
# View all available player profiles (again)
players()
#> # A tibble: 2 x 2
#> name balance
#> <chr> <chr>
#> 1 Player 1 100.000000
#> 2 Player 2 100.000000
Now it’s time to head off to the casino! What do you want to play first?!
<- Poker$new(who = "Player 1", type = "stud", bet = 10)
x #> Loading player profile...
# play a game
$play()
x#> You bet 10; you have 90 left.
#> Hand: 2 ♦, 3 ♦, A ♠, 3 ♥, K ♦
#> Result: one pair
#> You lost -10!
#> Now you have 90 in your account.
#> Do you want to `play()` again?
# specify a different bet for this game
$play(bet = 5)
x#> You bet 5; you have 85 left.
#> Hand: 10 ♦, J ♣, J ♠, Q ♠, 9 ♣
#> Result: one pair (jacks or better)
#> You won 0!
#> Now you have 90 in your account.
#> Do you want to `play()` again?
<- Poker$new(who = "Player 1", type = "draw", bet = 20)
x #> Loading player profile...
# play a game
$play()
x#> You bet 20; you have 70 left.
#> Hand: 2 ♠, 3 ♥, 3 ♠, 6 ♦, 8 ♦
#> Choose cards to `hold()`` and then `draw()`.
$hold(1, 2, 5) # hold cards in positions {1, 2, 5}
x#> Hand: 2 ♠, 3 ♥, 3 ♠, 6 ♦, 8 ♦
#> Choose cards to `hold()`` and then `draw()`.
$draw() # draw new cards for positions {3, 4}
x#> Hand: 2 ♠, 3 ♥, 8 ♦, K ♦, 7 ♣
#> Result: K high
#> You lost -20!
#> Now you have 70 in your account.
#> Do you want to `play()` again?
<- Blackjack$new(who = "Player 1", bet = 25)
x #> Loading player profile...
$play()$stand()
x#> You bet 25; you have 45 left.
#> Player Hand: {7, A} = 18
#> Dealer Hand: {?, A} = ?
#> Will you `hit()` or `stand()`?
#> Game over! push
#> You won 0!
#> Now you have 70 in your account.
<- Slots$new(who = "Player 1", bet = 1)
x #> Loading player profile...
$play()
x#> You bet 1; you have 69 left.
#> Reels: & & *
#> You lost -1!
#> Now you have 69 in your account.
#> Do you want to `play()` again?
# set the `spins` argument to play > 1 game at a time
$play(spins = 2)
x#> You bet 1; you have 68 left.
#> Reels: * & ^
#> You lost -1!
#> Now you have 68 in your account.
#> You bet 1; you have 67 left.
#> Reels: * ^ %
#> You lost -1!
#> Now you have 67 in your account.
#> Do you want to `play()` again?
If you want to play a lot of games, you can write a script. Just make
sure to silence the output (verbose = FALSE
) and sounds
(sound = FALSE
).
# poker (stud)
<- Poker$new(who = "Player 1", type = "stud", bet = 10, verbose = FALSE, sound = FALSE)
x #> Loading player profile...
for (i in 1:50)
suppressMessages(x$play())
# blackjack (blind)
<- Blackjack$new(who = "Player 1", bet = 5, verbose = FALSE, sound = FALSE)
x #> Loading player profile...
for (i in 1:50) {
suppressMessages(x$play())
if (x$active)
$stand()
x
}
# penny slots
<- Slots$new(who = "Player 1", bet = 1, verbose = FALSE, sound = FALSE)
x #> Loading player profile...
suppressMessages(x$play(spins = 50))
#> Do you want to `play()` again?
If you run out of money, the Bank will immediately loan you 100.
You: “So, what’s the interest rate on this loan?” Bank: “Oh, don’t worry. It’s very reasonable…”
# player profile is stored in `$who` of a game object
<- x$who
player
$debt()
player#> [1] 300
What a fun day at the casino! Or, was it?
# player profile is stored in `$who` of a game object
<- x$who
player
# Overall
$summary()
player#> # A tibble: 1 x 4
#> games bet win net
#> <int> <dbl> <dbl> <dbl>
#> 1 157 739 566 -173
# By Game
$summary(game)
player#> # A tibble: 3 x 5
#> game games bet win net
#> <chr> <int> <dbl> <dbl> <dbl>
#> 1 Blackjack 51 275 245 -30
#> 2 Poker 53 411 204 -207
#> 3 Slots 53 53 117 64
Let’s relive the excitement!
$plot() player
Well, I guess we’ll you’ll be back tomorrow. See you then!
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.