Mahjong solitaire (also known as Shanghai solitaire, electronic or computerized mahjong, solitaire mahjong or simply mahjong) is a single-player matching game that uses a set of mahjong tiles rather than cards. It is more commonly played on a computer than as a physical tabletop game.
Its name comes from the four-player game mahjong, but it is played entirely differently.
The 144 tiles are arranged in a 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 won when all pairs of tiles have been removed from the board, and lost if the remaining tiles contain no exposed pairs.
Playing Mahjong solitaire optimally in the sense to maximize the probability of removing all tiles is PSPACE-complete, and the game