Type: Package
Title: Play Casino Games
Version: 0.1.0
Description: Play casino games in the R console, including poker, blackjack, and a slot machine. Try to build your fortune before you succumb to the gambler's ruin!
License: MIT + file LICENSE
URL: https://anthonypileggi.github.io/casino, https://github.com/anthonypileggi/casino
BugReports: https://github.com/anthonypileggi/casino/issues
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.1
Imports: magrittr, dplyr, tibble, tidyr, purrr, crayon, R6, ggplot2, utils
Suggests: knitr, rmarkdown, beepr
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2019-01-10 21:52:04 UTC; anthony
Author: Anthony Pileggi [aut, cre]
Maintainer: Anthony Pileggi <apileggi20@gmail.com>
Repository: CRAN
Date/Publication: 2019-01-17 17:40:03 UTC

Blackjack R6 Class

Description

Blackjack R6 Class

Usage

Blackjack

Format

An object of class R6ClassGenerator of length 24.

Examples

set.seed(101315)
setup()

# sit at the blackjack table
x <- Blackjack$new(who = "Player 1", bet = 10)

# play a hand
x$play()

x$hit()

x$stand()

# play a hand blind w/out drawing
x$play()$stand()

# clean-up
delete()

Deck R6 Class

Description

Deck R6 Class

Usage

Deck

Format

An object of class R6ClassGenerator of length 24.

Examples

# create a new deck
x <- Deck$new()
x

# draw a card
x$draw(1)
x

# draw 10 cards
x$draw(10)

# check how many cards are left
x$cards_left()

# reset the deck
x$shuffle()
x

# create a deck composed of 5 decks
x <- Deck$new(decks = 5)
x

Player R6 Class

Description

Player R6 Class

Usage

Player

Format

An object of class R6ClassGenerator of length 24.

Examples

setup("my_profile")
Player$new("Player 1")
Player$new("Player 2")
delete()

Poker R6 Class

Description

Poker R6 Class

Usage

Poker

Format

An object of class R6ClassGenerator of length 24.

Examples

set.seed(101315)
setup()

# draw poker
x <- Poker$new(who = "Player 1", type = "draw", bet = 10)
x$play()
x$hold(1, 2, 5)
x$draw()

# stud poker (bet 20)
x <- Poker$new(who = "Player 1", type = "stud", bet = 20)
x$play()

# clean-up
delete()

Slots R6 Class

Description

Slots R6 Class

Usage

Slots

Format

An object of class R6ClassGenerator of length 24.

Examples

set.seed(101315)
setup()

# start the slot machine
x <- Slots$new(who = "Player 1", bet = 10)

# play 1 game
x$play()

# play >1 game at a time
x$play(spins = 3)

# clean-up
delete()

Delete all player history and re-lock the casino

Description

Delete all player history and re-lock the casino

Usage

delete()

Play in the casino

Description

Play in the casino

Usage

play()

Play blackjack

Description

Play blackjack

Usage

play_blackjack(name)

Arguments

name

player name


Play poker

Description

Play poker

Usage

play_poker(name, type)

Arguments

name

player name

type

game type ('draw' or 'stud')


Play the slot machine

Description

Play the slot machine

Usage

play_slots(name)

Arguments

name

player name


Play a sound (if possible)

Description

Play a sound (if possible)

Usage

play_sound(sound = "fanfare")

Arguments

sound

character string or number specifying the sound (see beep)

Note

requires the 'beepr' package


List all player profiles

Description

List all player profiles

Usage

players(file = Sys.getenv("CASINO_FILE"))

Arguments

file

full path to file containing player profiles


Allow casino to store player profiles in a local file

Description

Allow casino to store player profiles in a local file

Usage

setup(file = file.path(getwd(), ".casino"))

Arguments

file

full path to file