According to Tom Sloper there are four "schools" of how to create a layout (tile arrangement) or "board":
a) "Canned, and winnable". Japanese programmers tend to create "canned" tile arrangements - they are carefully planned and arranged to have just the right amount of traps, yet be winnable. There is no mathematical program algorithm at all - the tile arrangements are all carefully planned by a game designer. You get a very limited number of arrangements, but a challenging game. The drawback is that some players can memorize the pattern for removing the pairs.
b) "Random" - American programmers tend to create purely "random" tile arrangement - with no guarantee as to winnability or challenge. You get a huge number of possible arrangements.
c) "Random, but winnable" - Every game is winnable (at least one path to victory and possibly several to failure). The program uses an algorithm to arrange the tiles a pair at a time, from the bottom and up. You still get a lot of possible arrangements.
d) The game uses a "seed" number to generate some arrangements, not all of which are solvable.
Several solitaire mahjongg games let's you choose between "random" and "random, but winnable" layouts.
Most solitaire mahjongg computer implementations can generate puzzles that are guaranteed to be solvable.
According to Jarno Elonen it is impossible to come up with an algorithm that could always solve them. This is correct for the case where you are not allowed to peek below the tiles.
If, however, you are allowed to peek under the tiles
before taking them (complete-information variant of the game), it
is obviously possible to write a solver. See: Pedro Gimeno Fortea
(read more about the Shanghai auto-solver in Misc.
Source: tile arrangement: Tom Sloper in rec.games.mahjong 'Re: Arcade Activision Shanghai', 1998/04/03, and in rec.games.computer.puzzle 'Re: Mahjong/Solitile thoughts..' 1998/10/27
[Rules] [Layouts] [Tilesets]
[Online] [Freeware] [Shareware]