Mahjong solitaire is a solitaire matching game that uses a set of mahjong tiles rather than cards. It is also known as Shanghai solitaire, electronic or computerized mahjong, solitaire mahjong and simply as mahjong. The tiles come from the four-player game mahjong.
The 144 tiles are arranged in a special four-layer pattern with their faces upwards. A tile is said to be open or exposed if it can be moved either left or right without disturbing other tiles. The goal is to match open pairs of identical tiles and remove them from the board, exposing the tiles under them for play. The game is finished when all pairs of tiles have been removed from the board or when there are no exposed pairs remaining.
Tiles that are below other tiles cannot be seen. But by repeated undos and/or restarts which some programs offer, one gradually gets more and more information. Sometimes, tiles are only partially covered by other tiles, and the extent to which such tiles can be distinguished depends on the actual tile set.
Playing Mahjong solitaire optimally in the sense to maximize the probability of removing all tiles is PSPACE-complete, and the game gets NP-complete when peeking below tiles is allowed.
Condon, Feigenbaum, Lund, and Shor proved that it is PSPACE-hard to approximate the maximum probability of removing all tiles within a factor of , assuming that there are arbitrarily many quadruples of matching tiles and that the hidden tiles are uniformly distributed. The perfect-information version of this puzzle is where the player knows, before the game starts, the position of every tile. Eppstein proved that in this case, it is NP-complete to decide whether all tiles can be removed.