NEW: Source Code - Help out with translating this to new languages!
Issue Tracker - You can also vote on what features you'd like to see.
You can also see a video of a strong player talking through his thoughts at this link.

This is a tile efficiency trainer for Japanese (Riichi) Mahjong. It could work for some other forms of Mahjong, but won't recognize any yaku/fan that aren't in Japanese Mahjong, so it will be somewhat inaccurate.

For every possible discard, the trainer will check how many tiles the resulting hand could draw to improve its shanten (distance from ready). If you discard a tile that isn't the best option, it will tell you the difference in efficiency. The drill completes when the hand reaches ready.

Note that playing simply for efficiency is not the optimal way to play Mahjong. It can make you easier to read. Defense is much more important. Going for high value hands often requires going against efficiency. There are many articles online that can elaborate on this. But, knowing how much efficiency you're giving up can help you better assess whether it's worth going for. This reddit comment has more info.

Settings

  • Tiles Allowed - This lets you remove certain suits from the wall.  The less suits, the less obvious the correct discard will generally be.
  • Three player rules - This removes the 2 through 8 of characters from the wall and prevents you from having the North wind as your seat wind, as if you were playing three player.
  • Red Fives - This adds the provided number of red fives to the wall. They are added in the order dots -> characters -> bamboo. If you have a suit removed, the red fives in that suit will also be removed and not be replaced, so having red fives set to 3 while having bamboo disabled will result in 2 red fives.
  • Verbose tile names - If enabled, tiles will be displayed in text as "(number) of (suit)", like "one of bamboo". If disabled, they will be written in shorthand, "(number)(character representing suit)", like "1s". "m" is for characters (manzu), "s" is for bamboo (souzu), and "p" is for circles (pinzu).
  • Concise history - Strips down the history output to something like "Discard: 1p (36 tiles). Best: 9m, with 38 tiles. Draw: 5s." Less clear for new players, but is easier to skim.
  • Show what the best option was - If enabled, the Hand History will name what the optimal tile was. As this will usually still be the optimal tile on the next draw, it can make the drill easier, if more informative.
  • Shuffle discarded tiles back into the wall after starting a new hand - If disabled, your hand will be added to the discard pile when generating a new one. The new hand will come from the tiles remaining in the wall. This can make the exercise harder, as there's more information to consider.
  • Simulate other players discarding tiles - If enabled, every time you discard a tile, three more tiles will be discarded from the wall. This gives more information to consider. Note that the ghost players don't have hands.
  • Consider exception hands - Allows the shanten calculation to consider Kokushi and Chiitoitsu. Chiitoitsu is a special hand made up of seven pairs, and Kokushi is a special hand made up of one of each terminal and honor with a pair of any. These hands tend to be slow to build so this option lets you ignore them without getting told you're being inefficient.
  • Sort hand - Whether to display the hand sorted. Uncheck this to practice reading unsorted hands.

Loading A Hand

To load a hand, enter a text representation of the hand. Enter all the values of the tiles in a suit, then a letter representing the suit, and repeat for all suits.

  • For Character tiles, use the letter "m" for man, "w" for wan, or "c" for characters/cracks.
  • For Bamboo tiles, use the letter "s" for sou, or "b" for bamboo.
  • For Circle tiles, use the letter "p" for pin.
  • For Honor tiles, use "z" or "h" for honors.
  • The Honor tiles are ordered, from 1 to 7, East, South, West, North, White, Green, Red.
  • Red fives are represented by a 0. A 0 in the Honor suit is invalid.
  • To specify the drawn tile or dora indicator, enter a number between 0 and 37, where 0~9 are characters, 10~19 are circles, 20~29 are bamboo, and 31~37 are the honors.
  • Follow this number with "t" for the drawn tile (tsumo).
  • Follow this number with "d" for the dora indicator.
  • To specify the round and seat winds, enter a number between 1 and 4, followed by "j" for the seat wind (jikaze), or by "r" or "b" for the round wind (bakaze).

For example, 340m778s236677p55z. The order of the suits doesn't matter, and you can have as few or as many as you want. Any invalid characters will be ignored, so a string like "345 man 778 sou 236677 pin 55 honor" would also (coincidentally) work, as all the extra letters don't represent suits. If you provide a hand with fewer than 14 tiles, tiles will be added at random to fill it. A hand with more than 14 tiles will result in only the last 14 tiles appearing. A hand with more than 4 of a tile will only have 4 of that tile.

See Also

Development log

View all posts

Comments

Log in with itch.io to leave a comment.

Really great stuff, I'm learning a lot from your trainer, as a beginner Mahjong player. Thanks a bunch! Discovered you through DdRMaSTeRDan's YT channel.