# pairingGame: Play Pairing Game In CSJCampbell/throwdown: Strategies for playing the Pairing Game

## Description

Play a game by providing a sequence of numbers (typically 5). The game is played in the following sequence:

1. player a reveals her first number

2. player b reveals his first two numbers

3. player a selects one of player b's revealed numbers to match with her revealed number

4. player a reveals her next two numbers

5. player b selects one of player a's revealed numbers to match with his revealed number

6. player b reveals his next two numbers

7. player a selects one of player b's revealed numbers to match with her revealed number

8. player a reveals her next two numbers

9. player b selects one of player a's revealed numbers to match with his revealed number

10. the remaining two numbers are matched.

For each match, the player with the higher number wins one point. The player with the most points wins the game. The picker functions must have arguments active, revealed, type and exclude. active and revealed must be numeric vectors. type must be a length 1 character vector with value "reveal" or "pair". If type is "reveal", the function must pick the index of active to reveal. If type is "pair", the function must pick index of revealed to pair. exclude must be NA, or a numeric vector, which is the index of revealed to ignore when type is "reveal".

## Usage

 `1` ```pairingGame(a, b, strata = pickerFirst, stratb = pickerFirst) ```

## Arguments

 `a` numeric vector of player a pieces `b` numeric vector of player b pieces of length a `strata` picker function to select between two numbers for player a `stratb` picker function to select between two numbers for player b

## Value

length 2 vector number of wins for player a and player b

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15``` ```pairingGame(a = 1:5, b = 5:1) pairingGame(a = 10:14, b = 10:14) pairingGame(a = 1:5, b = c(5, 1:4)) pairingGame(a = rep(1, 5), b = rep(1, 5), strata = pickerFirst, stratb = pickerFirst) pairingGame(a = 1:5, b = 5:1, strata = pickerRandom) pairingGame(a = 1:5, b = c(5, 1:4), strata = pickerRandom, stratb = pickerRandom) pairingGame(a = 1:5, b = c(5, 1:4), strata = pickerRandom, stratb = pickerMax) pairingGame(a = 1:5, b = c(5, 1:4), strata = pickerRandom, stratb = pickerJustMax) set.seed(22532) pairingGame(a = sample(1:5, size = 5), b = sample(1:5, size = 5), strata = pickerRandom, stratb = pickerRandom) ```

CSJCampbell/throwdown documentation built on May 6, 2019, 9:26 a.m.