At the end of a hand of Mah Jongg, the winner is paid based on the
final score of the hand. Generally, the final score is limited to 500
points. There are, however, some extraordinary hands which simply score
this limit amount. These conditions are checked first; if none of these
are true, then the normal hand scoring is performed.
-
The Big Three Dragons hand has three
Set
s for which the
bigDragon
function is true.
-
The Little Four Winds hand has three
ThreeSet
s or FourSets
s
for which the wind
function is true and a
PairSet
for which wind
is true.
-
The Big Four Winds hand has four
ThreeSet
s or FourSets
s
for which the wind
function is true.
-
The All Honors hand has all
Set
s composed of
HonorsTile
s; these will all have either
wind
or dragon
true.
-
The All Terminals hand has all
Set
s composed of
TerminalSuitTile
s.
An additional hand that pays the limit also breaks many of the
rules for a winning hand. This is the Thirteen
Orphans hand, which is one each of the various terminals and
honors: three dragons, four winds, three one's, three nine's and any
other of the thirteen terminal and honor tiles. This requires a
special-case test in Hand
that short-cuts all of
the evaluation algorithm.
An interesting limit hand is the Nine Gates
hand, which is 3×1's, 2, 3, 4, 5, 6, 7, 8, and 3×9's all of the same
suit. Any other tile of this suit will create a winning hand that pays
the limit. Just considering the hand outside the mechanics of play, it
would get four doubles because it is all one suit, plus the possibility
of an additional double for consecutive sequences. The Nine Gates hand
is only a limit hand if the player draws it as a completely concealed
hand.
There are a few other limit hands, including all concealed
triplets, or being dealt a winning hand. These, however, depend on the
mechanics of play, not the hand itself.
Update Set Class Hierarchy. You'll want to add wind
and
dragon
functions to the
Set
hierarchy. These return
True
if all Tile
s in the
Set
are a wind or a dragon,
respectively.
Update Hand Class. You can add six additional functions to
Hand
to check for each of these limit
hands.
The final step is to update the finalScore
to
check for limit hands prior to computing points and doubles.