Shanten: Difference between revisions

2 bytes removed ,  24 August 2015
Line 21: Line 21:
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.
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.


== How to count 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 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.


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


=== Accurate shanten ===
=== Accurate shanten ===
10,011

edits