No description, website, or topics provided.
Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE
README.md
efrons_dice.py

README.md

efrons-dice

efrons_dice.py is a Python program which finds non-transitive dice combinations (e.g. Efron's dice) by selecting combinations of dice to maximise the sum of the number of times each dice beats its (next) neighbour.

Author: Richard Stebbing

License: GPLv3 (refer to LICENSE)

Dependencies

This repository is tested to work under Python 2.7 and Python 3.4.

This repository requires Numpy.

Getting Started

To dump all combinations of non-transitive dice with num_sides = 6, num_labels = 7, and num_dice = 4 (Efron's dice):

python efrons_dice.py --no-output-progress > efrons_dice.log

The (partial) output is:

num_sides: 6
num_labels: 7
num_dice: 4
num_unique_dice: 924

1/19> *
s: 104
0: [27, 83, 195, 340]
[[0 0 0 0 6 0 0]
 [0 0 0 6 0 0 0]
 [0 0 4 0 0 0 2]
 [0 2 0 0 0 4 0]]
...
7/19> 24
s: 96
0: [83, 195, 409, 728]
[[0 0 0 6 0 0 0]
 [0 0 4 0 0 0 2]
 [0 3 0 0 0 3 0]
 [2 0 0 0 4 0 0]]
1: [195, 409, 728, 83]
[[0 0 4 0 0 0 2]
 [0 3 0 0 0 3 0]
 [2 0 0 0 4 0 0]
 [0 0 0 6 0 0 0]]
2: [409, 728, 83, 195]
[[0 3 0 0 0 3 0]
 [2 0 0 0 4 0 0]
 [0 0 0 6 0 0 0]
 [0 0 4 0 0 0 2]]
3: [728, 83, 195, 409]
[[2 0 0 0 4 0 0]
 [0 0 0 6 0 0 0]
 [0 0 4 0 0 0 2]
 [0 3 0 0 0 3 0]]
(4)
...

where:

  • In each block, s is the maximum sum of the number of times each dice beats its (next) neighbour. The dice indices and corresponding dice matrices follow, where for each dice matrix entry i, j is the number of sides with label j on dice i.
  • The first block 1/19> * does not require each dice to beat its neighbour the same number of times; the subsequent blocks do.
  • Efron's dice are found under 7/19> 24, where each dice beats its neighbour 24 times out 36. (Four entries are given because all configurations are equivalent under rotation.)

Run python efrons_dice.py -h for further usage details.