The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
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[@]dogado.de.
This vignette shows how to play bootwar using an interleaved deck built with an anonymous function. An interleaved deck gives users the ability to sample cards from different distributions for different players.
Initialization is the same as for a standard 52 card deck or an anonymous deck.
# Load bootwar
library(bootwar)
# Set up vectors for computer and player's cards and values
<- vector(mode = "character")
comp_cv <- vector(mode = "numeric")
comp_vv <- vector(mode = "character")
plyr_cv <- vector(mode = "numeric") plyr_vv
Use the deck_of_cards parameter of shuffle_deck() to define a different custom deck of cards for each player by using an anonymous function to return a list of decks.
<- 123
seed set.seed(seed)
# Shuffle the deck
<- mmcards::shuffle_deck(
ideck deck_of_cards = function(x) {list(as.integer(stats::runif(26, 25, 50)),
as.integer(stats::runif(26, 35, 55)))},
seed = seed
)
head(ideck)
#> card value
#> 7 A_7 38
#> 41 B_4 37
#> 21 A_21 47
#> 131 B_13 41
#> 6 A_6 26
#> 51 B_5 54
The rest of the workflow follows the same structure as the README.
<- play_round(cdeck = ideck,
rres plyr_cv = plyr_cv, plyr_vv = plyr_vv,
comp_cv = comp_cv, comp_vv = comp_vv)
for (i in 1:4) {
<- play_round(cdeck = rres$updated_deck,
rres plyr_cv = rres$plyr_cv, plyr_vv = rres$plyr_vv,
comp_cv = rres$comp_cv, comp_vv = rres$comp_vv)
}
# Ensure 10 cards have been dealt
nrow(rres$updated_deck)
#> [1] 42
<- analyze_game(plyr_vv = rres$plyr_vv, comp_vv = rres$comp_vv,
gres mode = "pt", nboot = 1000, seed = 150, conf.level = 0.05)
# Display game results
$winner
gres#> [1] "Computer Wins"
$bootstrap_results$effect.size
gres#> [1] -2.2
$bootstrap_results$ci.effect.size
gres#> 47.5% 52.5%
#> -0.2 0.2
$bootstrap_results$p.value
gres#> [1] 0.744
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.
Health stats visible at Monitor.