Shanten: Difference between revisions

From Japanese Mahjong Wiki
Jump to navigation Jump to search
m (Fix min() in maximum shanten formula)
mNo edit summary
 
(16 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''Shanten''' {{kana|向聴}} is the number of tiles needed for reaching [[tenpai]]. It can also be viewed as the minimum number of tile draws or [[naki|tile calls]] required to attain tenpai.
'''Shanten''' {{kana|向聴}} 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==
==Shanten counts==
The lower the shanten count, the closer the hand is to tenpai. Naturally, that is advantageous as far as [[tile efficiency]] is concerned. After all, the sooner the hand gets to tenpai, then the sooner can the hand win.  For every shanten count, the hand needs any needed tile just to reduce that count.
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===
===Iishanten===
Line 17: Line 19:
:{{#mjt:457p111m246s1255z}}  Needs: Any {{#mjt:23456789p12345678s125z}} to 2-shanten.
:{{#mjt:457p111m246s1255z}}  Needs: Any {{#mjt:23456789p12345678s125z}} to 2-shanten.


== Open vs closed ==
==Strategy==
{{main|Naki}}
Knowing your hand's shanten can help with strategy, such as deciding whether to [[defense|push or fold]], or whether to [[naki strategy|call or stay closed]].


Often, the decision to open the hand rests on the tiles needed and the yaku most conveniently acquired. In addition, the shanten count may play a factor too, especially at 1-shanten where a discarded tile could put the hand into tenpai.
Of course, knowing the hand's [[tile acceptance]] is also important. A 1-shanten hand with tile acceptance = 2 is worse than a 2-shanten hand with tile acceptance = 20.
 
===Iishanten Peak Theory===
Going from 1-shanten to tenpai is the slowest part of most hands.  
* As a hand lowers its shanten, its tile acceptance lowers. A 2-shanten hand will have a higher acceptance than 1-shanten hand, meaning it is faster to progress from 2-shanten -> 1-shanten than it is 1-shanten -> tenpai.
* While a hand in tenpai has an even lower # tile acceptance, it can call [[ron]] freely, which adds a lot to hand speed.
 
Therefore, maximizing acceptance at 1-shanten is ''typically'' best for [[tile efficiency]].


== Counting shanten ==
== Counting shanten ==
Multiple methods can be applied to count shanten and to quickly estimate the shanten count. The variable names below are obvious enough, but with the extra precision that a hand or sub-hand that has groups removed will not include pairs with tiles removed.
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.
 
=== "Useless" tile 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 count tends to be lower if a hand contains 4 or fewer blocks (defining "blocks" as groups/taatsu/pairs). It tends to be higher if it has 6 blocks, or if it lacks a pair.


=== Minimum shanten ===
It is important to note that this method of counting useless tiles does not account for [[chiitoitsu]] or [[kokushi musou]].
Minimum shanten can easily be checked by how many useless tiles are in hand (any single 3 away, plus single word tiles). It is important to remember that seven pairs and kokushi musou will ignore this basic calculation.


  ''minimumShanten'' = min(''uselessTiles'', 6 - ''pairs'', 13 - ''diffTerminals'' - max(''terminalPairs'', 1)).
  ''EstimatedShanten'' = ''Useless_tiles''


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


=== Maximum or basic shanten ===
=== Basic shanten ===
Maximum shanten can easily be estimated by naïvely removing groups from the hand, then counting pairs, then taatsu. Assuming no pairs are present, the worst shanten count is always 6. Removing different possible groups will lead to different results: the lowest result from the universe of removable groups is the correct result. Taking away 345 from 1123456 is entirely possible in the process but removing 123 and 456 is clearly more optimal. With more complex hands, it is less obvious which tiles to remove: it is essential to test every possibility '''or''' skip obvious possibilities, such as if a quad occurs, it makes sense to check the first set of three, and skip over the rest, continuing from the 4th tile and the following two.
A hand with 13 disconnected tiles, the furthest a hand can be from the "4 groups + 1 pair" shape, would be 8-shanten from said shape. Drawing any tile, forming a [[taatsu]] or [[pair]], brings it 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.


''maximumShanten'' = min(8 - 2 * ''groups'' - max(''pairs'' + ''taatsu'', floor(''hand.length''/3)-''groups'') - min(1, max(0, ''pairs'' + ''taatsu'' - (4 - ''groups''))), 6).
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 (8-4-1=) 3-shanten.


=== Accurate 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.
Accurate shanten uses the maximum formula, and then includes the conditions for seven pairs and kokushi musou.


  ''accurateShanten'' = min(8 - 2 * ''groups'' - max(''pairs'' + ''taatsu'', floor(''hand.length''/3)-''groups'') - min(1, max(0, ''pairs'' + ''taatsu'' - (4 - ''groups''))), 6 - ''pairs'', 13 - ''diffTerminals'' - max(''terminalPairs'', 1)).
  ''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 paira: 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 most cases; notable exceptions include hands with 3 groups + 1 taatsu + 2 isolated tiles (which is 1-shanten), or 4 groups + 1 lone tile (which is tenpai).
 
=== 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) ===
=== Accurate correction (perfect shanten) ===
Calculating accurate shanten will give a proper result, -1 indicating a complete hand, any strictly positive integer indicating a distance from tenpai. However, when the result is zero, there is a chance that there are no tiles existing that could lead to creating a winning hand. From 34 possible tiles, trying out every tile ''not present in four copies'' should lead either to a complete hand (-1), or a hand that is "still tenpai" (0). A tenpai hand that can't win does not exist, usually because of the need of a 5th copy of a tile. This does not take into account tiles discarded or melded by other players. Only one's hand and one's melds count against this limit.
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 gameplay purposes. (This only accounts for tiles in the hand, not tiles discarded or in other players' hands.)
 
:{{#mjt:3456p111m}} {{#mjt:3'336'66p}} Waiting for: {{#mjt:36p}}
 
The above hand has no possible tiles that it could draw to form a winning shape; there doesn't exist a 5th 3-pin or 6-pin.
 
Therefore, when ''accurateShanten'' = 0, then make the following correction:
*Count the shanten the hand has after drawing every possible remaining tile. A proper test would never make a 5th copy of a tile.
*Take the lowest shanten from the above step, then add 1 to it.


:{{#mjt:3456p111m}} {{#mjt:3'336'66p}}
(This means that, if there is no possible tile that results in a winning hand, the hand is treated as 1-shanten. If there is a possible winning hand, then it is treated as tenpai.)
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==
==External links==

Latest revision as of 19:24, 14 October 2024

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.

Strategy

Knowing your hand's shanten can help with strategy, such as deciding whether to push or fold, or whether to call or stay closed.

Of course, knowing the hand's tile acceptance is also important. A 1-shanten hand with tile acceptance = 2 is worse than a 2-shanten hand with tile acceptance = 20.

Iishanten Peak Theory

Going from 1-shanten to tenpai is the slowest part of most hands.

  • As a hand lowers its shanten, its tile acceptance lowers. A 2-shanten hand will have a higher acceptance than 1-shanten hand, meaning it is faster to progress from 2-shanten -> 1-shanten than it is 1-shanten -> tenpai.
  • While a hand in tenpai has an even lower # tile acceptance, it can call ron freely, which adds a lot to hand speed.

Therefore, maximizing acceptance at 1-shanten is typically best for tile efficiency.

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.

"Useless" tile 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 count tends to be lower if a hand contains 4 or fewer blocks (defining "blocks" as groups/taatsu/pairs). It tends to be higher if it has 6 blocks, or if it lacks a pair.

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

EstimatedShanten = 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, the furthest a hand can be from the "4 groups + 1 pair" shape, would be 8-shanten from said shape. Drawing any tile, forming a taatsu or pair, brings it 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 (8-4-1=) 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 paira: 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 most cases; notable exceptions include hands with 3 groups + 1 taatsu + 2 isolated tiles (which is 1-shanten), or 4 groups + 1 lone tile (which is tenpai).

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 gameplay purposes. (This only accounts for tiles in the hand, not tiles discarded or in other players' hands.)

Waiting for:

The above hand has no possible tiles that it could draw to form a winning shape; there doesn't exist a 5th 3-pin or 6-pin.

Therefore, when accurateShanten = 0, then make the following correction:

  • Count the shanten the hand has after drawing every possible remaining tile. A proper test would never make a 5th copy of a tile.
  • Take the lowest shanten from the above step, then add 1 to it.

(This means that, if there is no possible tile that results in a winning hand, the hand is treated as 1-shanten. If there is a possible winning hand, then it is treated as tenpai.)

External links