Tuesday, May 21, 2019

Calculating Shanten and Ukeire

After my last post, which included an exercise that requires you to calculate a hand's shanten number and ukeire count, some people asked me how you do that. It's not too complicated.

For a standard hand's shanten, you essentially follow this flow with a 14 tile hand:
  1. Count 1 if there is a pair in the hand.
  2. Count 2 for each completed or called set in the hand.
  3. Count 1 for each partial set in the hand (up to 4 partial + completed sets)
  4. Subtract the result from 8.
The result is the hand's shanten. A shanten of 0 is a tenpai hand, and a shanten of -1 is a winning hand. There's also an edge case where a 0-shanten (tenpai) hand is actually 1-shanten if all the tiles that it wins on are in your hand (for example, having a 89p shape, but a kan of 7p). That's easy enough, right? Let's try it out.

We have a pair of nines, so we'll start by counting 1. We have one complete set (123m), so we'll count two more, for 3. Then we have four partial sets (46m, 67p, 12s, 68s), but we've counted one complete set already, so we can only count three here, for a total of 6. Finally, 8 - 6 is 2, so this hand is 2-shanten.

This has a lot of similarities to the Five Block Theory, so it should be fairly intuitive if you're familiar with that. The hand above has six blocks, so one needs to be cut, and one doesn't count towards the shanten.

For chiitoitsu, it's simply 6 minus the number of pairs in the hand. For kokushi, it's 13 minus the number of unique orphans, minus one more if you have a pair. Those are easy enough that we don't need examples. The hand's shanten is the minimum of the three numbers (standard, chiitoitsu, and kokushi shanten).

Next, ukeire. Ukeire is "the number of tiles you could draw that would reduce your shanten." Therefore, we calculate it with a 13 tile hand, and so, we need to know which tile we'll be discarding. In this case, let's assume we discard the 1s and pretend it's not in the hand.

We have five blocks, so we only need to look at what completes those blocks. In this case, our incomplete blocks are 46m, 67p, and 68s. The tiles that complete those blocks are 5m, 58p, and 7s, respectively. Since we can't see any of those tiles, we just count four for each, and get an ukeire of 16. Straight-forward!

Do note that ukeire is not a direct measurement of how fast the hand is. Discarding the 4p would give more ukeire, but if you open the hand in HMS, you'll see that breaking the 12s group is a little bit faster. The floating 4p can turn into a good group to usurp one of the closed waits. It's a good starting point, though.

Things get a LOT more complicated when you don't have five blocks. Let's look at an example.

Using our newfound shanten calculating skills, we can see that this is 3-shanten. A pair, a complete set, and two partial sets. For ukeire, we need to imagine discarding a tile, so let's discard the 1s again. I have enough birds in my life.

Our partial blocks are 12m, 88m, and 889s. The tiles that complete these are 3m, 8m, 7s, and 8s. We can see two 8m and two 8s, so that's 4 + 2 + 4 + 2 = 12 ukeire. However, we only have four blocks. We need a fifth block, so any tile we draw that creates a partial set also reduces our shanten.

Our floating tiles are 5m, 2p, 7p, and 8s (breaking the 889s into 8s + 89s). The tiles that make blocks out of these are 34567m, 1234p, 56789p, 6789s. Every tile up to two away from a floating tile. We've already counted 3m, 7s, and 8s, so we reduce that to 4567m123456789p69s. Wow, that's a lot! Fifteen types, times four is 60 tiles. We can see seven of those, so it gets reduced to 53. Add the 12 from before and we get a total ukeire of 65. Phew!

It's probably not worth calculating the ukeire when you don't have five blocks, just because there's so much, and it's not always reflective of the best choice. For example, in this hand, discarding the 8s leads to the highest ukeire, while discarding the 1s gets you to tenpai fastest. But, it's a neat exercise, and hopefully you know how to do it now!

1 comment:

  1. just started mahjong and been wondering how people can immediately tell how many tiles away I was from tenpai
    so this article is really helpful, thank you

    ReplyDelete