The table
Three players, 84 tiles: circles 1–9 (four copies), East/South/West/North, three dragons
(four copies), four flies (jokers), and sixteen bonus tiles (flowers,
seasons, faces and animals). Flowers and bonuses are set aside and replaced immediately.
Flowers and seasons are numbered 1–4 for East, South, West and North.
Each player starts with 13 tiles; the dealer draws a 14th. Play moves East → South → West.
A winning hand is four sets and a pair, seven pairs, or nine gates. Sets are pongs, kongs,
or circle chows. Pongs, kongs and chows can all be claimed; a chow may only be
called by the player immediately after the discarder. A fly may complete a
claimed pong when you hold one copy, or a claimed chow with one real hand tile — but
two flies cannot pong, and kongs always need four original tiles. If a pong used a fly
and you later draw the matching tile, the real tile joins the pong and the fly returns
to your hand; the pong can then be promoted to a kong normally. On your turn you may
also lay a fly face up in your flower row for +1 fan; opponents cannot
claim it, and you draw a replacement tile before discarding. A tile you discarded
earlier is sacred: you cannot win on a copy of it.
A win always beats a pong, kong or chow. When both players can win, the next player in
turn order after the discarder has priority, whatever shape their winning claim takes:
a pong, a chow, or a set completed with a single tile or fly. If the next player cannot
win, the farther player's win still beats a nearer pong or chow. A winning claim may
pair the discard with a single tile or a single fly; the usual pong rules do not apply
to a win. When nobody can win on the discard, a pong from an original pair beats a pong
that spends a fly, even if the fly pong is nearer. Otherwise, between two pongs (or two
kongs), the player nearest in turn order after the discarder has first refusal; if they
pass, the other player may still claim. A chow is offered once any higher claim has
been declined.
Winning & payment
A hand must be worth at least 5 fan (capped at 10). A win is worth
100 + 20 × fan points. On a self-draw both opponents pay double. On a
discard, the discarder pays double and the other player pays the normal amount. Kongs pay
immediately: 100 from each opponent for a concealed kong, 50 for an exposed or promoted
kong.
The winner becomes East and deals the next hand. The other two players take South and
West in turn order from that seat. If the wall runs out, the hand is a draw and the
dealership passes to the next player, who becomes East.
Fan reference
House simplification: faces and animals score one fan each. Limit hands cap at 10 fan.
How the AI improves
The bot uses a small neural network with a shared trunk and three heads: a value estimate,
a discard policy over the 17 playable tile kinds, and a claim policy. A Web Worker plays
three copies of the network against each other, scores every decision by the final points
swing, and updates the network with policy-gradient and value regression. Weights and
evaluation history are saved in local storage; with Cloud AI on, the
weights are also published to a shared global checkpoint so training continues from other
devices.
Early decisions are guided by a shanten/ukeire heuristic. As training continues, the learned
policy takes over. Open AI Lab to watch games, win rate and loss curves.