Talk:Shanten
Articles
- http://blog.ezyang.com/2014/04/calculating-shanten-in-mahjong/ 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):
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.