The point value for a hand can be doubled a number of times for a
variety of rare achievements. Most of these rules of these are
additional properties of Set
s that are summarized
by the Hand
.
Each non-pair Set
that contains lucky tiles
is worth 1 double (2×). In the case of the player's wind being the
prevailing wind, a Set
of this wind is worth 2
doubles (4×)
A hand of four ThreeSet
or
FourSet
(i.e., no
SequenceSet
) merits a double. Depending on how
the hand was played and how many of these triples were concealed or
melded, the hand can have a second double, or possibly even pay the
house limit, something we'll look into in the section called “Limit Hands”. For now, we are ignoring these
mechanics of play issues, and will simply double the score if there are
no SequenceSet
s.
A hand that has three consecutive
SequenceSet
s in the same suit is doubled. There
are many rule variations on this theme, including same-rank sequences
from all three suits, same-rank ThreeSet
s or
FourSet
s from all three suits. We'll focus on the
three-consecutive rule for now.
If the hand is worth exactly 20 points (it is all
SequenceSet
s and an unlucky
PairSet
), then it merits one double.
There are six different consistency tests. These are exclusive and
at most one of these conditions will be true.
-
If the hand is all terminals and honors (no simples), it is
doubled.
-
If each set in the hand has one terminal or an honor in it,
the hand is doubled. A hand could have four
SequenceSet
s, each of which begins with one
or ends with nine, and a pair of honors or terminals to qualify for
this double.
-
If the hand is all simples (no terminals or honors), it is
doubled.
-
If all of the SuitTile
s are of the same
suit, and all other tiles are HonorsTile
s,
this is doubled.
-
If all of the SuitTile
s are of the same
suit, and there are no HonorsTile
s, this is
doubled four times (16×).
-
If the hand contains Set
s of all three
dragons, and one of those sets is a PairSet
,
this is called the Little Three Dragons, and
the hand's points are doubled.
There are a few more ways to add doubles, all related to the
mechanics of play, not to the hand itself.
Update Set Class Hierarchy. You'll need to add the following functions to the
Set
classes.
-
A lucky
function that returns
True
for a ThreeSet
or
FourSet
with lucky tiles (dragons, the
prevailing wind or the player's wind. It returns
False
for other kinds of
Set
s or Set
s without
lucky tiles.
-
A triplet
function that returns
True
for a ThreeSet
or
FourSet
. It returns False
for other kinds of Set
s.
-
A sequenceSuit
function that returns the
suit of a SequenceSet
. It returns
None
for other kinds of
Set
s.
-
A sequenceRank
function that returns the
lowest rank of a SequenceSet
. It returns
None
for other kinds of
Set
s.
-
An allSimple
function that returns
True
if the Set
contains
only simple tiles.
-
An noSimple
function that returns
True
if the Set
contains
no simple tiles. This is an all terminals and honors
Set
.
-
An oneTermHonor
function that returns
True
if the Set
contains
one terminal or honor. Since we only have a
simple
function, this is one non-simple
Tile
in the
Set
.
-
An suit
function that returns the suit
for a Set
of all
SuitTile
s (either
SimpleSuitTile
s or
TerminalSuitTile
s). It returns
None
if the Set
contains
HonorsTile
s.
-
An bigDragon
function that returns
True
for a TreeSet
or
FourSet
of dragons.
-
An littleDragon
function that returns
True
for a PairSet
of
dragons.
Update Hand Class. You'll need to add the following functions to the
Set
classes.
-
luckySets
(
prevailWind
,
myWind
) returns the number of
lucky sets. This function also checks for the double wind conditions
where
prevailWind
is the same as
myWind
and one of the
Set
s has this condition and throws an
additional doubling in for this.
-
groups
returns 1
if
all Set
s have the triple
property True
.
-
sequences
returns 1
if three of the Set
s have the same value for
sequenceSuit
, and the values for
sequenceRank
are 1, 4, and 7.
-
noPoints
returns 1
all of the Set
s are worth zero points.
-
consistency
returns 1
or 4
after checking for the following conditions.
If allSimple
is true for all
Set
s, return 1
. If
noSimple
is true for all
Set
s, return 1
. If
oneTermHonor
is true for all
Set
s, return 1
. If every
Set
has the same value for
suit
and there are no
Set
where suit
is None,
return 4
. If every Set
has
the same value for suit
or the value for
suit
is None, return 1
. If
there are two Set
s for which
bigDragon
is true, and one
Set
s for which
littleDragon
is true, return
1
.
The sum of the double functions is the total number of doubles for
the hand. This is d
=
luckySets
(
prevailWind
,
myWind
) + groups
+ sequences
+ noPoints
+ consistency
. This sum is the power
of 2 to use: the score is multiplied by
2
d
. An amazing hand of
all one suit with three consecutive sequences leads to 5 doubles, 32×
the base number of points.
You'll want to add a doubleReport
which
prints a small scorecard for the hand, showing each double that was
awarded. You can then write a scoreCard
which
products the pointReport
, the
doubleReport
and the final score of
points
×
2
doubles
.
The total score is often rounded to the nearest 10, as well as
limited to 500 or less to produce a final score. This final score is
used to settle up the payments at the end of the game.