Shanten: Difference between revisions

149 bytes added ,  3 July 2023
m
Fix min() in maximum shanten formula
m (Getting 2 or 6s here allows completing the kanchan to go to a shanpon wait, or upgrading the shanpon to a group + pair and waiting on the kanchan. Similarly for the 3-shanten hand.)
m (Fix min() in maximum shanten formula)
 
(5 intermediate revisions by 2 users not shown)
Line 5: Line 5:


===Iishanten===
===Iishanten===
{{main|Iishanten}}
'''Example''': 1-shanten
'''Example''': 1-shanten
:{{#mjt:456p111m246s1155z}}  Needs: Any {{#mjt:35s15z}} to tenpai.
:{{#mjt:456p111m246s1155z}}  Needs: Any {{#mjt:35s15z}} to tenpai.
Line 10: Line 11:
===Ryanshanten===
===Ryanshanten===
'''Example''': 2-shanten
'''Example''': 2-shanten
:{{#mjt:456p111m246s1255z}}  Needs: Any {{#mjt:2356s125z}} to 1-shanten.
:{{#mjt:456p111m246s1255z}}  Needs: Any {{#mjt:12345678s125z}} to 1-shanten.


===Sanshanten===
===Sanshanten===
'''Example''': 3-shanten
'''Example''': 3-shanten
:{{#mjt:457p111m246s1255z}}  Needs: Any {{#mjt:36p2356s125z}} to 2-shanten.
:{{#mjt:457p111m246s1255z}}  Needs: Any {{#mjt:23456789p12345678s125z}} to 2-shanten.


== Open vs closed ==
== Open vs closed ==
Line 27: Line 28:
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.
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)).
''minimumShanten'' = min(''uselessTiles'', 6 - ''pairs'', 13 - ''diffTerminals'' - max(''terminalPairs'', 1)).


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.
Line 34: Line 35:
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.
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.


''maximumShanten'' = max(8 - 2 * ''groups'' - max(''pairs'' + ''taatsu'', floor(''hand.length''/3)-''groups'') - min(1, max(0, ''pairs'' + ''taatsu'' - (4 - ''groups''))), 6).
''maximumShanten'' = min(8 - 2 * ''groups'' - max(''pairs'' + ''taatsu'', floor(''hand.length''/3)-''groups'') - min(1, max(0, ''pairs'' + ''taatsu'' - (4 - ''groups''))), 6).


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


=== Accurate correction (perfect shanten) ===
=== Accurate correction (perfect shanten) ===
Line 51: Line 52:
[[Category: Terminology]]
[[Category: Terminology]]
[[Category: Strategy]]
[[Category: Strategy]]
* [https://pathofhouou.blogspot.com/2019/05/calculating-shanten-and-ukeire.html Calculating Shanten and Ukeire]


{{navbox strategy}}
{{navbox strategy}}