Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
games.hexad: rst fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mezzarobba committed Apr 11, 2015
1 parent 819000f commit 30599c4
Showing 1 changed file with 107 additions and 70 deletions.
177 changes: 107 additions & 70 deletions src/sage/games/hexad.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
r"""
Hexads in S(5,6,12)
This module completes a 5-element subset of as 12-set X
into a hexad in a Steiner system S(5,6,12) using Curtis and
Conway's "kitten method". The labeling is either the
"modulo 11" labeling or the "shuffle" labeling.
This module completes a 5-element subset of as 12-set X
into a hexad in a Steiner system S(5,6,12) using Curtis and
Conway's "kitten method". The labeling is either the
"modulo 11" labeling or the "shuffle" labeling.
The main functions implemented in this file are
blackjack_move and find_hexad. Enter "blackjack_move?"
for help to play blackjack (i.e., the rules of the game), or
"find_hexad?" for help finding hexads of S(5,6,12) in the
shuffle labeling.
The main functions implemented in this file are
blackjack_move and find_hexad. Enter "blackjack_move?"
for help to play blackjack (i.e., the rules of the game), or
"find_hexad?" for help finding hexads of S(5,6,12) in the
shuffle labeling.
This picture is the kitten in the "shuffle" labeling:
This picture is the kitten in the "shuffle" labeling::
6
Expand All @@ -30,7 +30,7 @@
1 0
The corresponding MINIMOG is
The corresponding MINIMOG is::
_________________
| 6 | 3 | 0 | 9 |
Expand All @@ -44,21 +44,26 @@
See the docstrings for find_hexad and blackjack_move for
further details and examples.
AUTHOR::
David Joyner (2006-05)
AUTHOR:
REFERENCES::
R. Curtis, ``The Steiner system $S(5,6,12)$, the Mathieu group $M_{12}$,
and the kitten,'' in {\bf Computational group theory}, ed. M. Atkinson,
Academic Press, 1984.
J. Conway, ``Hexacode and tetracode - MINIMOG and MOG,'' in {\bf Computational
group theory}, ed. M. Atkinson, Academic Press, 1984.
J. Conway and N. Sloane, ``Lexicographic codes: error-correcting codes from
game theory,'' IEEE Trans. Infor. Theory32(1986)337-348.
J. Kahane and A. Ryba, ``The hexad game,'' Electronic Journal of Combinatorics, 8 (2001)
http://www.combinatorics.org/Volume_8/Abstracts/v8i2r11.html
David Joyner (2006-05)
Some details are also online at: http://www.permutationpuzzles.org/hexad/
REFERENCES:
R. Curtis, The Steiner system $S(5,6,12)$, the Mathieu group $M_{12}$,
and the kitten, in *Computational group theory*, ed. M. Atkinson,
Academic Press, 1984.
J. Conway, Hexacode and tetracode - MINIMOG and MOG, in *Computational
group theory*, ed. M. Atkinson, Academic Press, 1984.
J. Conway and N. Sloane, *Lexicographic codes: error-correcting codes from
game theory*, IEEE Trans. Infor. Theory 32 (1986) 337-348.
J. Kahane and A. Ryba, The hexad game, *Electronic Journal of Combinatorics*, 8 (2001)
http://www.combinatorics.org/Volume_8/Abstracts/v8i2r11.html
Some details are also online at: http://www.permutationpuzzles.org/hexad/
"""
#*****************************************************************************
Expand Down Expand Up @@ -86,6 +91,7 @@ def view_list(L):
as in Curtis' paper.
EXAMPLES::
sage: from sage.games.hexad import *
sage: M = Minimog(type="shuffle")
sage: view_list(M.line[1])
Expand Down Expand Up @@ -118,6 +124,7 @@ def picture_set(A,L):
This is needed in the find_hexad function below.
EXAMPLES::
sage: from sage.games.hexad import *
sage: M = Minimog(type="shuffle")
sage: picture_set(M.picture00, M.cross[2])
Expand All @@ -134,6 +141,7 @@ class Minimog():
triple system S(5,6,12).
EXAMPLES::
sage: from sage.games.hexad import *
sage: Minimog(type="shuffle")
Minimog of type shuffle
Expand Down Expand Up @@ -230,6 +238,7 @@ def __str__(self):
"""
EXAMPLES::
sage: M = Minimog(type="modulo11")
sage: print M
Minimog of type modulo11 associated to
Expand All @@ -245,6 +254,7 @@ def _latex_(self):
Prints latex code.
EXAMPLES::
sage: M = Minimog(type="modulo11")
sage: latex(M)
Minimog of type modulo11 associated to
Expand All @@ -263,6 +273,7 @@ def print_kitten(self):
of symbols).
EXAMPLES::
sage: from sage.games.hexad import *
sage: M = Minimog("shuffle")
sage: M.print_kitten()
Expand Down Expand Up @@ -304,15 +315,21 @@ def print_kitten(self):

def find_hexad0(self, pts):
"""
INPUT::
pts -- a set of 2 distinct elements of MINIMOG, but not
including the "points at infinity"
OUTPUT::
hexad containing pts and of type 0 (the 3 points "at infinity" union a line)
INPUT:
- pts -- a set of 2 distinct elements of MINIMOG, but not including the
"points at infinity"
OUTPUT:
- hexad containing pts and of type 0 (the 3 points "at infinity" union a line)
NOTE:
NOTE:: 3 points "at infinity" = {MINIMOG[0][2], MINIMOG[2][1], MINIMOG[0][0]}
3 points "at infinity" = {MINIMOG[0][2], MINIMOG[2][1], MINIMOG[0][0]}
EXAMPLES::
sage: from sage.games.hexad import *
sage: M = Minimog(type="shuffle")
sage: M.find_hexad0(set([2,4]))
Expand All @@ -339,15 +356,19 @@ def find_hexad0(self, pts):

def find_hexad1(self, pts):
"""
INPUT::
pts -- a set pts of 5 distinct elements of MINIMOG
OUTPUT::
hexad containing pts and of type 1 (union of 2 parallel lines -- *no*
points "at infinity")
INPUT:
pts -- a set pts of 5 distinct elements of MINIMOG
OUTPUT:
hexad containing pts and of type 1 (union of 2 parallel lines -- *no*
points "at infinity")
NOTE:: 3 points "at infinity" = {MINIMOG[0][2], MINIMOG[2][1], MINIMOG[0][0]}
NOTE: 3 points "at infinity" = {MINIMOG[0][2], MINIMOG[2][1], MINIMOG[0][0]}
EXAMPLES::
sage: from sage.games.hexad import *
sage: M = Minimog(type="shuffle")
sage: M.find_hexad1(set([2,3,4,5,8]))
Expand Down Expand Up @@ -376,15 +397,18 @@ def find_hexad1(self, pts):

def find_hexad2(self, pts, x0):
"""
INPUT::
pts -- a list S of 4 elements of MINIMOG, not including
any "points at infinity"
x0 -- in {MINIMOG[0][2], MINIMOG[2][1], MINIMOG[0][0]}
INPUT:
- pts -- a list S of 4 elements of MINIMOG, not including any "points
at infinity"
- x0 -- in {MINIMOG[0][2], MINIMOG[2][1], MINIMOG[0][0]}
OUTPUT:
OUTPUT::
hexad containing S \union \{x0\} of type 2
hexad containing `S \union \{x0\}` of type 2
EXAMPLES::
sage: from sage.games.hexad import *
sage: M = Minimog(type="shuffle")
sage: M.find_hexad2([2,3,4,5],1)
Expand Down Expand Up @@ -417,16 +441,19 @@ def find_hexad2(self, pts, x0):

def find_hexad3(self, pts, x0, x1):
"""
INPUT::
pts -- a list of 3 elements of MINIMOG, not including
any "points at infinity"
x0,x1 -- in {MINIMOG[0][2], MINIMOG[2][1], MINIMOG[0][0]}
INPUT:
- pts -- a list of 3 elements of MINIMOG, not including any "points at
infinity"
- x0,x1 -- in {MINIMOG[0][2], MINIMOG[2][1], MINIMOG[0][0]}
OUTPUT::
hexad containing pts \union \{x0,x1\} of type 3 (square at
picture of "omitted point at infinity")
OUTPUT:
hexad containing pts \union \{x0,x1\} of type 3 (square at
picture of "omitted point at infinity")
EXAMPLES::
sage: from sage.games.hexad import *
sage: M = Minimog(type="shuffle")
sage: M.find_hexad3([2,3,4],0,1)
Expand All @@ -453,24 +480,29 @@ def find_hexad3(self, pts, x0, x1):

def find_hexad(self, pts):
"""
INPUT::
pts -- a list S of 5 elements of MINIMOG
INPUT:
pts -- a list S of 5 elements of MINIMOG
OUTPUT::
hexad containing S \union \{x0\} of some type
OUTPUT:
NOTE:: 3 "points at infinity" = {MINIMOG[0][2], MINIMOG[2][1], MINIMOG[0][0]}
hexad containing $S \union \{x0\}$ of some type
NOTE: 3 "points at infinity" = {MINIMOG[0][2], MINIMOG[2][1], MINIMOG[0][0]}
Theorem (Curtis, Conway): Each hexads is of exactly one of the following types:
0. $\{3 ``points at infinity''\}\cup \{{\rm any\ line}\}$,
1. the union of any two (distinct) parallel lines in the same picture,
2. one ``point at infinity'' union a cross in the corresponding picture,
3. two ``points at infinity'' union a square in the picture corresponding
to the omitted point at infinity.
0. {3 "points at infinity"} $\cup$ {any line},
1. the union of any two (distinct) parallel lines in the same picture,
2. one "point at infinity" union a cross in the corresponding picture,
3. two "points at infinity" union a square in the picture corresponding
to the omitted point at infinity.
More precisely, there are 132 such hexads (12 of type 0, 12 of type 1, 54 of type 2,
and 54 of type 3). They form a Steiner system of type $(5,6,12)$.
EXAMPLES::
sage: from sage.games.hexad import *
sage: M = Minimog(type="shuffle")
sage: M.find_hexad([0,1,2,3,4])
Expand All @@ -485,15 +517,18 @@ def find_hexad(self, pts):
sage: M.find_hexad([1,2,3,4,SR(infinity)]) # random (machine dependent?) order
([+Infinity, 2, 3, 4, 1, 10], ['square 8', 'picture 0'])
AUTHOR::
David Joyner (2006-05)
AUTHOR:
REFERENCES::
R. Curtis, ``The Steiner system $S(5,6,12)$, the Mathieu group $M_{12}$,
and the kitten,'' in {\bf Computational group theory}, ed. M. Atkinson,
Academic Press, 1984.
J. Conway, ``Hexacode and tetracode - MINIMOG and MOG,'' in {\bf Computational
group theory}, ed. M. Atkinson, Academic Press, 1984.
David Joyner (2006-05)
REFERENCES:
R. Curtis, The Steiner system $S(5,6,12)$, the Mathieu group $M_{12}$,
and the kitten, in *Computational group theory*, ed. M. Atkinson,
Academic Press, 1984.
J. Conway, Hexacode and tetracode - MINIMOG and MOG, in *Computational
group theory*, ed. M. Atkinson, Academic Press, 1984.
"""
MINIMOG = self.minimog
Expand Down Expand Up @@ -574,16 +609,17 @@ def blackjack_move(self, L0):
"""
L is a list of cards of length 6, taken from {0,1,...,11}.
Mathematical blackjack::
MATHEMATICAL BLACKJACK
Mathematical blackjack is played with 12 cards, labeled $0,...,11$
(for example: king, ace, $2$, $3$, ..., $10$, jack, where the king is
$0$ and the jack is $11$). Divide the 12 cards into two piles of $6$ (to be
fair, this should be done randomly). Each of the $6$ cards of one of these
piles are to be placed face up on the table. The remaining cards are in a
stack which is shared and visible to both players. If the sum of the cards
face up on the table is less than 21 then no legal move is possible so you must
shuffle the cards and deal a new game. (Conway calls such a game *={0|0},
where 0={|}; in this game the first player automatically wins.)
shuffle the cards and deal a new game. (Conway calls such a game `*={0|0}`,
where `0={|}`; in this game the first player automatically wins.)
* Players alternate moves.
* A move consists of exchanging a card on the table with a lower card from the other pile.
Expand All @@ -599,6 +635,7 @@ def blackjack_move(self, L0):
EXAMPLES::
sage: M = Minimog(type="modulo11")
sage: M.blackjack_move([0,2,3,6,1,10])
'6 --> 5. The total went from 22 to 21.'
Expand Down

0 comments on commit 30599c4

Please sign in to comment.