Talk:Shanten: Difference between revisions

From Japanese Mahjong Wiki
Jump to navigation Jump to search
(Created page with "==Articles== * http://blog.ezyang.com/2014/04/calculating-shanten-in-mahjong/ ~~~~")
 
 
Line 1: Line 1:
==Articles==
==Articles==
* http://blog.ezyang.com/2014/04/calculating-shanten-in-mahjong/ [[User:KyuuAA|KyuuAA]] ([[User_talk:KyuuAA|Talk:キュウ]]) 17:28, 7 August 2019 (UTC)
* http://blog.ezyang.com/2014/04/calculating-shanten-in-mahjong/ [[User:KyuuAA|KyuuAA]] ([[User_talk:KyuuAA|Talk:キュウ]]) 17:28, 7 August 2019 (UTC)
== Possible error in accurate shanten formula ==
The wiki reports this formula (ignoring the calculations for chiitoitsu and kokushi musou):
<nowiki>accurateShanten = 8 - 2 * groups - max(pairs + taatsu, floor(hand.length/3)-groups) - min(1, max(0, pairs + taatsu - (4 - groups)))).</nowiki>
Let's try to plug in values for a complete regular hand (14 tiles: 4 groups and 1 pair):
<nowiki>
accurateShanten = 8 - 2 * 4 - max(1 + 0, 4 - 4) - min(1, max(0, 1 + 0 - (4 - 4))) =
                        8 - 8 - 1 - 1 =
                        -2
</nowiki>
But -2 makes no sense! I think the correct formula should replace max with min:
<nowiki>accurateShanten = 8 - 2 * groups - min(pairs + taatsu, floor(hand.length/3)-groups) - min(1, max(0, pairs + taatsu - (4 - groups)))).</nowiki>
Now the result is -1 as expected:
<nowiki>
accurateShanten = 8 - 2 * 4 - min(1 + 0, 4 - 4) - min(1, max(0, 1 + 0 - (4 - 4))) =
                        8 - 8 - 0 - 1 =
                        -1
</nowiki>
Let me know if this makes sense. I hope I got right the meaning of the original formula.

Latest revision as of 23:53, 14 December 2021

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.