Take the 2-minute tour ×

I am able to calculate the shanten number myself, but it often takes me more than a minute. I'm looking for ideas how to become more efficient.

Background: I'm currently writing a paper about determining the shanten number with a computer algorithm. This works very well so far, but there are likely some ideas for improvements that I missed. I am a really poor Mahjong player myself, so input by experienced players would be most welcome.

This is a rough description of my (manual) strategy right now:

First, detect any tiles of which the usage is certain. This means tiles that are alone (no adjacent tile within a radius of 2) and sets that are completed (chi, pon).

I keep count of how many single tiles there are. Next, I look for incomplete sets (in a shape similar to any of 11x, 12x, 1x3, x23). I insert one of the singles into any of them and increment the shanten number in my head. During this step, I attempt to keep up to 2 pairs for later though.

There will be some singles or incomplete sets be left over, I split them up and multiply their number with 2/3 (because any 3 tiles can be made into a set by exchanging 2 of them). I also check if there are one or two pairs, if not, I create one (increasing shanten by 1). So far no problem at all, this only takes me a few seconds.

The trouble starts when there are multiple options how to combine tiles. Should I split this set up, or should I keep it? Should I add this tile here or there? Especially pure (only one suit) hands are annoyingly complex, and I could not figure out a fast way to solve them.

My algorithm of course just laughs at the hands I have trouble with, as it is able to solve even the most complicated hands in fractions of a second. It explores all reasonable ways how to combine the tiles in a tree (with heuristics) and yields the best option.

share|improve this question
For clarity, shall we assume you're just looking to complete any hand, rather than caring about the value or shape thereof? –  goldPseudo May 2 '13 at 6:28
@gold Yes. Yaku etc are not important. –  mafu May 2 '13 at 10:39
Already answered here: stackoverflow.com/questions/4239028/… –  Pieter Geerkens Nov 25 '13 at 23:50
@PieterGeerkens Yes, I found a way that works somewhat nicely, luckily. I should have linked the questions. I'll leave this on here, however, because it would be awesome to also have some input from a veteran player's perspective - I have very few experience with mahjong as a player sadly. –  mafu Nov 26 '13 at 18:35

1 Answer 1

If you're taking over a minute to count shanten you're thinking too hard. Shanten counting can be done in seconds using your head.
Look at your hand. For every pair or incomplete sequence, count 1. For completed melds, count 2. Subtract the total from 8. Do not count tiles with overlap!

Example: 1225dots 56bamboos 23588characters red east

12dots = 1
56bamboos = 1
23characters = 1
88characters = 1
total = 4
shanten = 8 - 4 = 4

share|improve this answer
Well, try something like 1233445567789m then :) –  mafu Nov 26 '13 at 18:32
The general idea is close to what I'm doing right now though. –  mafu Nov 26 '13 at 18:33

Your Answer


