An R package to play a two player game of pairing.
Play a game by providing a sequence of numbers (typically 5). The game is played in the following sequence:
A match is won by the player having the greatest number for each pair of numbers. The winner of the game has won the most matches.
This R package can be installed directly from GitHub using devtools.
# install devtools for devtools::install_github
install.packages("devtools")
library(devtools)
# install throwdown
install_github("CSJCampbell/throwdown")
This package also includes tests in testthat format.
From R run the call test_package("throwdown")
.
A game can be played by providing for each player a sequence of numbers and a function which will pick a number in one of two ways, pair or reveal.
library(throwdown)
# a function which selects numbers
pickerMax(active = 2, revealed = c(3, 1), type = "pair")
# play a game between two players
pairingGame(a = 1:5, b = c(5, 1:4),
strata = pickerRandom, stratb = pickerMax)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.