Talk:Shanten

Add topic
Active discussions

Articles

Possible error in accurate shanten formula

The wiki reports this formula (ignoring the calculations for chiitoitsu and kokushi musou):

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

Let's try to plug in values for a complete regular hand (14 tiles: 4 groups and 1 pair):

accurateShanten = 8 - 2 * 4 - max(1 + 0, 4 - 4) - min(1, max(0, 1 + 0 - (4 - 4))) = 
                        8 - 8 - 1 - 1 = 
                        -2

But -2 makes no sense! I think the correct formula should replace max with min:

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

Now the result is -1 as expected:

accurateShanten = 8 - 2 * 4 - min(1 + 0, 4 - 4) - min(1, max(0, 1 + 0 - (4 - 4))) = 
                        8 - 8 - 0 - 1 = 
                        -1


Let me know if this makes sense. I hope I got right the meaning of the original formula.

Return to "Shanten" page.