A mahjong discard drill that never shipped杭州麻将出牌训练器:写完没上线
- Year
- 2026
- Status
- Paused
- Outcome
- An engine built in three hours, tests still green; its question generator answers "safe" four times out of five
The decision I'm worst at in mahjong is also the one I make most often: which tile to throw away. This drills only that. It deals you fourteen tiles, you tap one to discard, and it scores every alternative you could have picked instead. Hangzhou house rules, where the white dragon is wild — more on that here. Source.
The engine is a thousand lines of plain JavaScript. How far you are from a winning hand gets evaluated three ways at once and scored at whichever is smallest, each wild tile taking a step off. The first version of the feedback read like a spreadsheet row — "shanten 1, 24 accepting tiles" — useless to exactly the player it was written for. A layer on top now turns those numbers into sentences: discarding the 9-man or the 8-man leaves you the same distance from a win, but the 9-man gives you ten more useful draws.
A second mode went in the same afternoon: read the opponents' discard piles and judge whether your tile is safe to throw. Shuffling won't produce those positions — random boards teach nothing. So the generator runs backwards. Decide what an opponent is collecting and what they're waiting on, derive a discard order they'd plausibly have produced, then deal a hand where the tile you most want to throw is exactly the one that loses.
Twenty-four of its twenty-five commits land inside a three-hour window on Feb 19, and one more the next evening. It has an appid and runs in the simulator, but it was never submitted for review and has never had a user. The acceptance checklist at the bottom of the plan document is nine empty boxes. The results page is still one line, Page({}), rendering the word "placeholder" on screen.
The safety mode gives you three buttons: safe, careful, dangerous. Run its own generator for 1,200 positions and, of the roughly 800 safety questions, over six hundred answers come back "safe," about a hundred and forty "dangerous," one or two "careful." The middle button is decoration, and tapping "safe" every time scores 82%. What it needed was a danger score spread evenly across the three bands. What it got instead, on that last evening, was a versus mode with six cloud functions behind it. The engine is sound — ten test files, ninety-one assertions, all still passing on a clean clone. What's missing is the unglamorous stretch between "it runs" and "someone uses it."