Package 'evilDice'

Title: Test Dice Sets for Intransitive Properties
Description: Checks to see whether a supplied set of dice (their face values) are transitive, returning pair-win and group-roll win probabilities. Expected returns (mean magnitude of win/loss) are presented as well.
Authors: Carl Witthoft [aut, cre]
Maintainer: Carl Witthoft <[email protected]>
License: LGPL-3
Version: 1.0
Built: 2024-11-01 06:51:24 UTC
Source: CRAN

Help Index


Test Dice Sets for Intransitive Properties

Description

Checks to see whether a supplied set of dice (their face values) are transitive, returning pair-win and group-roll win probabilities. Expected returns (mean magnitude of win/loss) are presented as well.

Details

The DESCRIPTION file:

Package: evilDice
Type: Package
Title: Test Dice Sets for Intransitive Properties
Version: 1.0
Date: 2023-03-08
Authors@R: c(person(given = "Carl", family = "Witthoft", email = "[email protected]", role = c("aut", "cre")))
Description: Checks to see whether a supplied set of dice (their face values) are transitive, returning pair-win and group-roll win probabilities. Expected returns (mean magnitude of win/loss) are presented as well.
License: LGPL-3
Imports: graphics
NeedsCompilation: no
Packaged: 2023-03-09 14:40:42 UTC; cgw
Author: Carl Witthoft [aut, cre]
Maintainer: Carl Witthoft <[email protected]>
Repository: CRAN
Date/Publication: 2023-03-10 07:50:09 UTC

Index of help topics:

evilDice                Function to Determine If a Set of Dice is
                        Intransitive ~~
evilDice-package        Test Dice Sets for Intransitive Properties

Intransitive dice are dice which display the unintuitive property that every die has a winning probability against another die and a losing probability against another die in the set. This function tests the input set, returning the pairwise probabilities along with other interesting data.

Author(s)

Carl Witthoft [aut, cre] Some fast algorithm code supplied by user "onyambu" at https://stackoverflow.com/questions/75463792/

Maintainer: Carl Witthoft <[email protected]>

References

https://en.wikipedia.org/wiki/Intransitive_dice


Function to Determine If a Set of Dice is Intransitive ~~

Description

Intransitive dice sets are dice which display the unintuitive property that every die has a winning probability against a die and a losing probability against another die in the set. This function tests the input set, returning the pairwise probabilities along with the expected returns (mean magnitude of win/loss). In addition, the win probabilities for each die when the entire set is rolled as a group are provided.

Usage

evilDice(thevals)

Arguments

thevals

An N-row by M-column array, where each column contains the (numeric) values of the N faces of a given die. Note: if dice with unequal numbers of faces are desired, enter the NA value as needed to fill the array.

Details

Any tie (both dice show the same number) is treated as "not a win" and the value passed to the "expected return" calculation is zero. Since the win percentages are valid for any set of dice, this function can be used to determine the win rate for transitive dice.

Value

thevals

Echoes back the input array.

pairs

A 2-column array. The first column contains the win percentage of the pair identified in the row name. The second column contains the expected return, i.e. the mean magnitude of the wins. The upper rows present the "operational" pairing, i.e. D1 –> D2 –> D3 ... Dn –>D1 . Following that, all other possible pairings are given, e.g. D1 –> D3 , D2 –> D4

groupwins

The set of winnng probabilities for all dice when rolled as a group.

diceType

A brief message stating whether the input values represent intransitive dice or not.

Author(s)

Carl Witthoft Maintainer:Carl Witthoft [email protected]

Examples

triDice <- cbind(c(2,2,4,4,9,9), c(1,1,6,6,8,8), c(3,3,5,5,7,7))
(evilDice(triDice))

# Bradley Efron computed this set. 
brad <- cbind(c(4, 4, 4, 4, 0, 0), c(3, 3, 3, 3, 3, 3), c(6, 6, 2, 2, 2, 2),c(5, 5, 5, 1, 1, 1))
(evilDice(brad))