Umpteenth Iteration Shanghai Solitaire

About Shanghai Solitaire

Shanghai Solitaire is a one player game played with the tiles from a Mahjongg set. It should not be confused with the game of Mahjongg itself, a fast paced four player game which has its origins in Chinese riverboat gambling.

In Shanghai Solitaire, you try to clear a board of all 144 of the Mahjongg pieces by removing them in pairs. You can only remove a pair if the faces of the two tiles match, and if both of the tiles are free. A tile is considered free if there is no other tile on top of it (even partly), and if there is a completely empty space on either its immediate right or its immediate left (or both).

There are four identical tiles that have each different kind of face, except for the four flowers and the four seasons. Any two flowers and any two seasons are considered a match even though they have different faces.

Sounds easy? Try it. Better yet, try to finish in less than two minutes. Sounds like just another solitaire game? Maybe so, but you might just find it completely addictive.

About this implementation

There are dozens of computer implementations of Shanghai Solitaire out there. Back in 1997, however, I couldn't find a free one which I liked, so I wrote my own. The name Umpteenth Iteration is meant to signify that I learned from the mistakes of the many other implementations I tried. By today's standards, there's nothing particularly special about my version. Still, it's free, open source, and platform neutral, so you might want to try it anyway.

The most unusual thing about Umpteenth Iteration is that I chose to write it in a language called Tcl/Tk (pronounced "tickle tee kay"), which has subsequently slipped into obscurity. The standard package, shanghai.zip, contains only source code and requires a separate Tcl/Tk interpreter to run. An easier alternative for Windows users is the shanghai.exe starpack, a binary version which has everything you need in a single file that doesn't even require any installation.

Screenshot

a screenshot of Umpteenth Iteration Shanghai Solitaire running on Linux

News

2003.05.28 - Modern versions of Tk have somewhat different event handling requirements from the version which existed in 1997. A small code change was necessary to prevent an error message from being displayed if you exited by clicking the "close" button.

Download

shanghai.zip (133kb)

shanghai.exe (1.2Mb)

home · dgslomin@alumni.princeton.edu · last updated 2003.05.28