RULES USED BY THE MAH-JONG PROGRAMS

The game currently implemented is a version of the classical Chinese
game. The most convenient and comprehensive set of rules is that
provided by A. D. Millington, "The Complete Book of Mah-Jongg", 
Weidenfield & Nicolson (1993), ISBN 0 297 81340 4.
In the following, M 103 denotes item 103 of the rules laid out in Chapter 3 
of that book. I here describe only the differences from these
rules, some of which differences are consequences of using computers,
and some of which are points where my house rules differ from
Millington's version. In due course, all variations (of Chinese
classical) will be accommodated, if there is sufficient desire.

Classification of tiles (M 1-8): the tiles are a standard Chinese set.
The tiles do not have Arabic numerals, except for the flowers and
seasons, where the identifying Chinese characters are too small to be
legible. ACKNOWLEDGMENT: the tiles (other than flowers and seasons)
are not my work. See the README in the tiles/ directory for credits.

Preliminary (M 9-10): nothing to say.

Duration of the game (M 11-14): standard rules. In particular, the
title of East does not pass after a wash-out.

Selection of seats (M 15): the players are seated in the
order they connect to the server, or randomly, according to the option 
given to the server.

The deal etc. (M 16-27): There is no attempt to simulate the usual
dealing ritual (M 16-20, 23-26); the wall is built randomly by the
server. The dead wall is also maintained by the server.
The dead wall is handled per Millington: namely, it is initially 16
tiles (M 22), and is not extended during play. Replacement tiles for
kongs are drawn from the dead wall, but replacements for bonus
tiles are drawn from the live wall (M 31).
It is intended to provide an option for the other common style of dead 
wall, namely 14 tiles, replenished, with bonus replacements from the
dead wall.

Object of game (M 28-31): all winning hands must comprise four sets
and a pair, with the sole exception of the Thirteen Unique Wonders.
Support for Seven Pairs may be added if there is demand.

Bonus tiles (M 31): M requires that bonus tiles must be declared in
the turn in which they are drawn; otherwise the player may not
exchange or score them (and thus they cannot go out). We do not make
this restriction, as it is (a) pointless (b) unenforceable in real
life. Bonus tiles may be declared at any time after drawing from the
wall. (Obviously, there is no reason not to declare them immediately.)

Commencement of the Game (M 32-33): standard.

Playing procedure (M 34-38): standard.
In particular, the other players have to give permission for
east to start playing (M 34).
The display of discards cannot be controlled by the server; the
current X client displays them in an organized fashion, rather than
the random layout required by M 35.

Chow (M 39-42): standard.

Pung (M 43-45): standard.

Kongs (M 46-52): M distinguishes three types of kong: concealed,
claimed (by Kong), and annexed (formed by adding a discard to an
exposed pung), and allows claimed kongs to be counted as concealed for 
the purposes of doubling combinations. We do not do this, following
the more common convention of treating such a kong as exposed for all
purposes.
Players may declare a concealed kong, or add to a pung,
only when they have just drawn a tile from the wall (live or dead);
not just after a claiming a discard. (A silly restriction in my view,
but one that all rule sets seem to have (M 51).)

Calling and Mah Jong (M 53-54): standard. (I.e. there is no "Calling"
declaration.)

NOTE: M permits players to change their mind about making a claim 
(M 69); we do not, and all claims are irrevocable. Question: should we 
allow revocation?

Original Call (M 55): the Original Call declaration must be made
simultaneously with the first discard, rather than afterwards.
NOTE: the server does *not* check that the declarer does indeed
have a calling hand, as a mistaken original call does not damage the
other players or the progress of the game. The server does, however,
thereafter prevent the declarer from changing their hand; therefore a
mistaken original call will make it impossible to go out. (Note: in M, 
an Original Caller may change their hand, but will thereby lose the
ability to go out (M 55(b)); is this a better way to treat it?)
Note also: as per M, an original call can be made even if another
player has claimed a discard before, unlike the Japanese version.

Robbing a Kong (M 57-60): Robbing a kong is implemented. However, as
with discards, we require that kongs are robbed before anything else
happens, and in particular before the konger draws a replacement tile.
Therefore, after a kong, all other players must either claim Mah Jong
or pass. (The provided programs will pass automatically if robbing is
not possible.) As for discards, there is a time limit.

Precedence of claims for discard (M 61-65):
Many rules allow a discard to be claimed up until the time the next
discard is made. M does this, with elaborate rules for the precise
specification.
For ease of implementation, we do not allow this: instead, all players 
are required to make a claim or pass, and once all players have
claimed, the successful claim is implemented irrevocably.
The server imposes a time limit; players that do not claim within
the limit are deemed to have passed. This defaults to 15 seconds,
but can be changed or disabled by the players (see program documentation).

Irregularities in Play (M 66-81): the server does not permit unlawful
moves, and so no irregularities can arise.

False Declaration of Mah Jong (M 82-83): such declarations are not
permitted by the server.

False Naming of Discards (M 84-88): this also cannot happen.

Incorrect Hands (M 89): cannot happen.

Letting Off a Cannon (M 90-96): as in M. However, if a player makes
a dangerous discard, but has no choice, the server will determine
this; it is not necessary to plead "no choice" explicitly, and neither 
is the player's hand revealed to the other players.

Wash-Out (M 97-99): standard.

Points of Etiquette (M 100-102): not applicable.

Displaying the Hand (M 103-106):
The format of display is a matter for the client program, and cannot
be controlled by the server.
After Mah Jong, the players are responsible for declaring concealed
sets in whatever way they wish. The winner, of course, is required to
declare a complete hand; but the losers may declare as they wish.
Once a set is declared, it cannot be revoked. Note that the losers may 
declare multiple scoring pairs.

Procedure in Settlement (M 107-111):
The settlement is standard: that is, the winner gets the value of
their hand from all players; the losers pay one another the
differences between their scores; except all payments to or from East
are doubled; and if players let off a cannon, they pay everybody's debt.
Unlike normal play (M 110), all hands are scored by the server, rather 
than by the players. Settlement is also computed by the server.

Method of Scoring (M 112-122):
The method is standard (M 112), viz calculate points obtained from
sets and bonuses, and then apply doubles.

The following points are given for tiles:

  Bonus tiles:
    4 each (M 114(a))

  Pungs:
    2 for exposed minor tiles; 4 for exposed major or concealed minor;
    8 for concealed major. (M 114(b))

  Kongs:
    8 for exposed minor; 16 for exposed major or concealed minor;
    32 for concealed major. (M 114(c))

  Chows:
    no score. (M 114(d))

  Pair:
    2 for a pair of Dragons, Own Wind, or Prevailing Wind.
    A pair that is both Own and Prevailing Wind scores 4. (M 114(e))
    Non-winning hands may score more than one pair.

  Basic points:
    the winner gets 20 points for going Mah Jong.
    (M 115(a) has 10 points. This will become an option.)

  Winning from wall:
    if the final tile is drawn from the wall, 2 points
    are added (M 115(b)). 

  Filling the only place:
    if the final tile is the only denomination
    that could have completed the hand, 2 points are added (M 115(c)).
    NOTE: As in M, if all four copies of a tile are exposed on the table,
    it does not count as available for completing the hand.

  Fishing the eyes:
    a player who completes by obtaining a pair gets 2
    points if the pair is minor, or 4 if major (M 115(d)).
    Note: to obtain these points for a discard, the player must actually
    claim the discard for a pair: e.g. if waiting on 5677, and 7 is
    discarded, the player must claim for the pair, not the chow.

The following doubles apply to all hands.
All possible clauses apply unless stated otherwise.

  Having own flower AND own season,
    1 double. (M 116(a)). 

  Having all four flowers,
    1 double. (M 116(b)).

  Having all four seasons,
    1 double. (M 116(b)).
    
    (Note: there will be options to change the flower/season doubles to
    less conservative values.)

  Each set of dragons,
    1 double. (M 116(d))

  A set of the player's own wind,
    1 double. (M 116(e))

  A set of the prevailing wind,
    1 double. (M 116(f))

  "Little Three Dragons": two sets and a pair of dragons.
    1 double. (M 116(g))

  "Big Three Dragons": three sets of dragons.
    2 doubles. (M 116(h))

  "Little Four Winds": three sets and a pair of winds.
    1 double. (M 116(i))

  "Big Four Winds": four sets of winds.
    2 doubles. (M 116(j))
    
    (Note: the definitions of these last four doubles when applied to
    non-winning hands are subject to wide variations. Possibly there
    should be options to allow other possibilities.)

  Three concealed pungs:
    1 double. (M 116(k))
    (Note: M allows a claimed kong to count as concealed for this hand;
    see the note above under "Kongs". We do not.)

The following doubles apply to the winning hand only:

  No score hand: four chows and a non-scoring pair.
    1 double. (M 117(a))
    (Note: like M, we allow any of the extra points (Fishing the Eyes,
    etc) to go with this double. Some rules say that the extra points
    invalidate this hand. Possibly there should be an option for this.)

  No chows:
    1 double. (M 117(b))

  Concealed hand:
    1 double. (M 117(c))
    (Note: according to a discussion on rec.games.mahjong, this double is
    classically awarded to a hand that is concealed up to the point of Mah 
    Jong. One book in my possession (U.S.A., early 1920s) awards it to a
    hand that is concealed except for the pair. Perhaps there should be
    options.)

  One suit with honours (with at least one set of honours):
    1 double. (M 117(d))

  One suit only:
    3 doubles. (M 117(e))

  All majors:
    1 double. (M 117(f))

  All honours (in an unlimited game):
    2 doubles. (M 117(g)) 
    (Should this also get the double for all majors? It doesn't now.)

  All terminals (in an unlimited game):
    2 doubles. (Not in M)
    (Should this also get the double for all majors? It doesn't now.)

  Winning with loose tile:
    1 double. (M 117(h))
    (Note: in the current setup, replacements for bonus tiles come from
    the live wall. Hence this double applies only to winning after Kong.)

  Winning from the bottom of the sea (winning with last tile),
    1 double. (M 117(i))

  Catching a fish from the bottom of the sea (winning with last discard),
    1 double. (M 117(j))

  Robbing a kong,
    1 double. (M 117(k))

  Completing Original Call,
    1 double. (M 117(l))

Limit (M 118-120): the limit is currently 1000. There will be an
option to change this.

The following hands are limit hands:

  Heaven's Blessing: East wins with dealt hand. (M 122(a))

  Earth's Blessing: player wins with East's first discard. (M 122(b))

  Gathering Plum Blossom from the Roof: winning with 5 Circles from the
    loose wall. (M 122(c))

  Catching the Moon from the Bottom of the Sea: winning with 1 Circle as 
    the last tile. (M 122(d))
    (Note: M says that the tile must be drawn. It seems more reasonable
    also to allow it to be the last discard, which is what we
    do. Objections?)

  Scratching a Carrying Pole: robbing a kong of 2 Bamboos. (M 122(e))

  (Note: these last three limits are rather arbitrary, but of the
    arbitrary limits they are apparently the most common. There should be
    options to disable them.)

  Kong upon Kong: making a Kong, making another Kong with the loose
    tile, and with the second loose tile obtaining Mah Jong. (Also, of
    course, with three or four successive kongs.) (M 122(f))

  Four Kongs. (M 122(g))

  Buried Treasure: all concealed and no chows. (M 122(h))

  The Three Great Scholars: three sets of dragons and no chows. (M 122(i))
    (Note: in most rules I have seen, there is no restriction to a no chow 
    hand. Since in M's rules, three sets and a chow scores at least
    (10 (M has 10 for Mah Jong) + 12 (at least 3 pungs))
    times 8 (2 for each set of dragons) times 4 (for Big Three Dragons)
    = 704, this is significant with the default limit. For us, with 20 for
    going out, Big Three Dragons is over the default limit anyway.)

  Four Blessings o'er the Door: four sets of winds and a pair. (M 122(j))

  All Honours. (M 122(k))

  Heads and Tails: all terminals. (M 122(l))

  Imperial Jade: contains only Green Dragon and 2,3,4,6,8 Bamboo. (M 122(m))
    (Note: another rather arbitrary hand, but widely adopted.)

  Nine Gates: calling on 1-1-1-2-3-4-5-6-7-8-9-9-9 of one suit. (M 122(n)).

  Wriggling Snake: 1-1-1-2-3-4-5-6-7-8-9-9-9 plus 2, 5 or 8 of 
    one suit (M 122(o)).
    (Note: another rather arbitrary hand.)

  Concealed Clear Suit: one suit only and all concealed. (M 122(p))

  Thirteen Unique Wonders: one of each major tile, and a match to any of 
    them. (M 122(q))

  East's 13th consecutive Mah-Jong. (M 122(r))


General note: there are many other doubles and limits kicking
around. I welcome opinions on which should be possible options; and
also on which of the above I should eject from the default set.
I dislike Imperial Jade, Wriggling Snake, and the ones depending on a
specific tile (Gathering Plum Blossom, Catching the Moon, Scratching a 
Carrying Pole): which of these are so commonly adopted that they
should be in even a fairly minimalist default set?
