Mahjongg

If you have the Tcl/Tk Plug-in for browers, you will see an application below. If you don't, go get the plugin or just download the maj.tcl program and run the file using tcl's wish ( #wish maj.tcl).

This is less than 400 lines of Tcl/Tk code. If you are interested, you can see the code by saving the maj.tcl link and viewing it using a standard text editor.

Like what you see? Imagine what you could build if you had a little Tcl/Tk expertise!
Check out the many links for Tcl/Tk and plugins at www.tcl.tk or their plugin test and demo page.

Instructions

The Mahjongg game has one objective - remove all the tiles. You do this by removing tiles in pairs with the provision that only tiles that have a free side (left or right) can be removed.

This game version is the traditional layout - there are many others available and web sites devoted to this game. This version is a two fold project - create the simpliest implimentation and create a platform neutral or web page based version. In going for the simpliest - the tiles are arranged in a real random manner which makes the game rather hard to beat.

The Tcl/Tk code is rather straight forward and simple. No fancy routines are used, considerable thinking about how to set arrays so the coding is simple did occur. This produced a very short program with a few complex tables and one complex layout routine. To add new layouts, these two items should be all that needs to be changed.

Please enjoy this game and thanks to sol.tcl ( available at the tcltk web site) for the starting idea, and Kmahjongg (KDE version ) for the tile set of graphics. I hope this plugin spawns many to try variations of it and create other little games for web fun and programming experience.

Bill Kibler at bill@kiblerelectronics.com