Persistent Player Profiles

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Introduction

Player information is stored in a local file. By default, this file is call .casino and it is placed in the current working directory.

library(casino)

# create a new file to store player profiles
setup()

# create some players
Player$new("Player 1")

# check the available players
players()

Multiple Players

You can store multiple players in the same profile file.

# create more players
Player$new("Player 2")
Player$new("Player 3")

# check the available players
players()

Multiple Profile Files

If you want to store multiple player profiles, you can specify the filename.

# first profile
setup(".bellagio")
Player$new("Player 1")
Player$new("Player 2")
players()

# second profile
setup(".caesars")
Player$new("Player 3")
Player$new("Player 4")
players()

# now switch back to the first one
setup(".bellagio")
players()

Delete Profiles

If you want to delete all players in the current profile and reset the casino package, use the delete() function.

# delete current profile (.bellagio)
delete()

# delete a different profile (.caesars)
setup(".caesars")
delete()

# delete the default profile (.casino)
setup()
delete()


Try the casino package in your browser

Any scripts or data that you put into this service are public.

casino documentation built on May 2, 2019, 8:41 a.m.