Shanten

From Japanese Mahjong Wiki
Jump to navigation Jump to search

Shanten 「向聴」 refers to the minimum number of tiles required in order for a hand to reach tenpai. For example, a hand in 1-shanten (iishanten) is one tile away from tenpai, and thus two tiles away from winning.

Shanten counts

Lower shanten counts are better: the lower the shanten, the closer the hand is to tenpai, and thus the closer the hand is to winning.

The maximum shanten a hand can have is 6-shanten, since all hands are 6-shanten or lower for chiitoitsu. The maximum shanten a hand could be from the standard "4 groups + 1 pair" shape is 8-shanten.

Iishanten

Example: 1-shanten

Needs: Any to tenpai.

Ryanshanten

Example: 2-shanten

Needs: Any to 1-shanten.

Sanshanten

Example: 3-shanten

Needs: Any to 2-shanten.

Counting shanten

Multiple methods can be used to count a hand's shanten. These can be used to get a quick estimate of shanten during a game.

Lower bound estimate

For the standard "4 groups + 1 pair" shape, every "useless" tile (any lone honor tile; number tiles with no neighbors in a +/- 2 interval) must be discarded or grouped in order to reach tenpai. Therefore, the # of useless tiles is a good minimum for the "4 groups + 1 pair" shape. The actual shanten may be higher, but usually isn't lower for the standard winning shape.

It is important to note that this method of counting useless tiles does not account for chiitoitsu or kokushi musou.

minimumShanten = Useless_tiles

This method is most effective at the start of a game, and less towards the end.

Basic shanten

A hand with 13 disconnected tiles would be 8-shanten from the "4 groups + 1 pair" shape, and is the highest shanten from that shape. Drawing a tile, forming a taatsu or pair, will get you a tile closer to tenpai, thus reducing shanten by 1. Completing a taatsu/pair, thus forming a tile group, will reduce shanten by 1 again (2 total). This results in the following calculation:

  • Every hand starts at 8-shanten.
  • Each complete group reduces shanten by 2. Each taatsu/pair in hand reduces shanten by 1.
  • However, a mahjong hand requires exactly 4 groups. This means the hand's (taatsu + pairs + groups) count is capped at 4. In other words, if a hand would have more than 4 taatsu/pairs/groups, any taatsu/pair past the 4th won't count.
  • In addition to 4 groups, the hand requires at least one pair. So, when (taatsu + pairs + groups) >= 5, having at least one pair will reduce shanten by 1.

For example, a hand with 6 taatsu and a lone tile is not (8-6=) 2-shanten; it is instead (8-4=) 4-shanten. A hand with 5 taatsu + 1 pair would be 3-shanten.

Note: A hand may be organized into different sets of groups. The interpretation with the lowest possible shanten is the correct answer. For example, "123456" could be interpreted as 1 complete group + 1 taatsu ("12 + 345 + 6") or 2 complete groups ("123 + 456"). In this case, the latter interpretation is clearly better. With more complex hands, it is less obvious which tiles to remove: it is essential to test every possibility or skip obvious possibilities.

basicShanten =
   8
   - 2 * groups 
   - max(taatsu + pairs, 4 - groups)
   - 1, if at least one pair and (taatsu + pairs + groups) >= 5

Basic shanten (simpler calc.)

There is a simpler way of explaining the above basic shanten calculation:

  • Every hand starts at 8-shanten.
  • Each complete group reduces shanten by 2. Each taatsu/pair in hand reduces shanten by 1.
  • If a hand has >= 6 blocks: +1 shanten
  • If a hand does not have a pair: +1 shanten
    • If a hand has 4 groups + 0 pairs: Set to tenpai

For "blocks" = (taatsu/pairs/groups). This is identical to the above calculation, but assumes all hands have a pair, then adds +1 shanten if it doesn't actually have a pair. This generalization works in all cases except when a hand in tenpai is waiting on a pair, which is why the "4 groups + 0 pair = tenpai" exception is present.

Chiitoitsu

The shanten for chiitoitsu is always (6 - pairs). A hand with 6 pairs is tenpai for chiitoitsu, a hand with 5 pairs is 1-shanten, and so on.

chiitoitsuShanten = 6 - pairs

Kokushi

The shanten for kokushi musou is 13, minus the number of unique terminals/honors, then minus 1 if you have at least one pair. This means a hand with no terminals/honors is 13-shanten from kokushi.

kokushiShanten = 13 - unique_terminals - max(terminal_pairs, 1)

Accurate shanten formula

Base formula

The accurate shanten formula combines the formulas for standard form, chiitoitsu, and kokushi musou.

accurateShanten = Smaller of:
   * 8 - (2 * groups) - max(pairs + taatsu, 4 - groups) - min(1, max(0, pairs + taatsu + groups - 4))
   * 6 - pairs
   * 13 - diffTerminals - max(terminalPairs, 1)

Accurate correction (perfect shanten)

Calculating shanten with the above formula will give a proper result, where -1 indicates a complete hand, while any positive integer is the distance from tenpai.

However, when the result is 0, there is a chance that there are no existing tiles that could lead to creating a winning hand. If a hand is 0-shanten, but has all 4 copies of its own winning tiles, as in the below example, then it usually does not count as "tenpai" for the purposes of gameplay. (This only accounts for tiles in the hand, not tiles discarded or in other players' hands.)

If accurateShanten = 0, for all possibilities of tile: keep lowest accurateShanten(hand + tile) value (-1 or 0) and add 1 (for 0 or 1). The hand above, when any other tile is added to it, is never complete. A proper test would never make a 5th copy of 3p or 6p.

External links