Shanten: Difference between revisions

589 bytes added ,  12 April 2015
no edit summary
No edit summary
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.


''Minimum'' = min(''uselessTiles'', 6 - ''pairs'', 13 - ''terminals'' - 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.


=== Maximum or basic shanten ===
=== Maximum or 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.
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 = max(8 - 2 * groups - max(pairs + taatsu, floor(hand.length/3)-g) - min(1,max(0,p+t-(4-g))), 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 ===
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)-g) - min(1,max(0,p+t-(4-g))), 6 - pairs, 13 - terminals - 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 46: Line 46:
:{{#mjt:3456p111m}} {{#mjt:3'336'66p}}
:{{#mjt:3456p111m}} {{#mjt:3'336'66p}}
   
   
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.
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==
478

edits