A Graphical Front-End for X-Mahjongg

Mohave is a graphical front end launcher for X-mahjongg, and it makes starting up the game nicer for selecting tilesets, backgrounds and layouts.

It is written in Tcl/Tk (see below), and the code is free to download here.

These 3 screenshots show the Mohave GUI on the left and the X-mahjongg window on the right. Mohave is used to select a tileset, background and layout and then start X-mahjongg.

Note: the next 3 images show an earlier version of Mohave, the latest version is shown down below.





I like solitaire mahjongg in its many computer variations, and x-mahongg is a basic version of the game that is started from the command line. However ........ although the command line rules for doing work, pushing buttons and viewing images rules for playing games. X-mahjongg unfortunately uses a command line startup, something like
xmahjongg --tileset name --layout name --background name etc etc
This requires me to remember all the tilesets, layouts and backgrounds (which I can't because I have run out of brainspace.)

Additionally, the default set of tilesets, layouts and backgrounds is not very large. However, x-mahjongg is fabulously capable of reading these features from other mahjongg versions (notably from the legendary Kyodai game, which does not run on Unix/Linux). So another task I am working is to gather some of these, resize and convert them (ImageMagick) and make them callable from the Mohave GUI.

There were approximately 30 tilesets, 22 backgrounds and 20 layouts included in the original Mohave package (this has been update, below).


Installing Mohave

This is a manual operation that probably requires root privileges, because the x-mahjongg folders on your computer are probably owned by root. You simply put the files (given below) in those folders. First, of course, you should install x-mahjongg. (I have both the Ubuntu and Debian flavors of Linux and this was a simple apt-get command.) X-mahjongg installs its original tilesets, backgrounds and layouts in directories like /usr/share/games/xmahjongg/tiles. You should verify this on your machine. This is where you must unpack the files below and move the Mohave tilesets, backgrounds and layouts.

The Tcl-script to run Mohave (there is a link to it below) is simply text file that requires a TclL/Tk interpreter that you must also have on your computer. Tcl/Tk is very likely already installed on your computer, but if it isn't, this is also a simple installation; and having Tcl/tk also opens doors for many other useful and fun applications freely available on the internet.

Near the top of the Tcl-script there are 3 lines as follows:

  • set tiledir "/usr/share/games/xmahjongg/tiles"
  • set bkgrddir "/usr/share/games/xmahjongg/backgrounds"
  • set layoutdir "/usr/share/games/xmahjongg/layouts"
  • You may have to edit these lines in the text file to point Mohave to the correct directories on your computer. This depends on which OS you have and how you installed xmahjongg. Simply change the directories on these 3 lines and save the file as [Mohave.tcl] and give it executable permission. You can read further down the script to see where these variables are used, for your info.

    Note: after saving the [Mohave.txt] text file, you must rename the text file to give it a [ .tcl ] extension and give it executable permission. I gave the text file its current [*.txt] extension simply so you can read it in your web browser before saving it to your disk.


    Running Mohave

    jpg

    Running Mohave is simple. Click (double-click?) the file or shortcut. A window somewhat like the image above pops up. Select a tileset from one of the 3 tilesets menus and a background from the background menu. These will appear in the window as you make your choice. Then select a layout from the layout menu (this will not change the window), and push the play x-mahjongg button below the window, to start x-mahjongg. You may, or may not, exit Mohave at this point and continue playing X-mahjongg.


    The Files for Mohave.v3

    You can open the Mohave.v3.txt file in your web browser to look at it. After you save it to your computer, again, you must rename it Mohave.v3.tcl and make it executable.

    The tileset images (57 of them) are in this (5.1Mb) archive: tilesets.57.tar.gz. You must download and unzip this archive and place the files in the folder that x-mahjongg uses on your computer (the location on my machine, is obvious from reading the Tcl-script..... it is /usr/share/games/xmahjongg/tiles on my machine). Do the same with the backgrounds.tar.gz and layouts.tar.gz images.

    If you read the text file (using a plain text editor), it contains references to tileset images all named "mohavesetxx.gif". Virtually every one of these are images that I shamelessly downloaded from links on the Kyodai web page and resized (ImageMagick) and converted to GIF format for x-mahjongg to use. Please note that I created none of the Kyodai-set images....they are all from other websites. Unfortunately, they had to be renamed to make the Tcl code reasonable, and allow swapping out images easy in the future, so their original identity has been lost to this purpose. (However many of them show identifying text in the lower right most tiles in the image, so check there for the original authors.) The websites sources all indicated the images were free to download and use, so I took the liberty to do so.

    Note about the original X-Mahjongg tilesets: because they have an extremely different image aspect ratio than the standard Kyodai tilesets, I have not yet been able to get the original tilesets to integrate properly with Mohave (all but one, anyway). This is still on my to-do list.

    Changing or Adding Tilesets and Backgrounds.


    X-mahjongg Screencaps

    ...... with some of the new tilesets and backgrounds....


    jpg jpg
    jpg jpg
    jpg jpg


    Past Versions

    jpg

    Mohave version 1 (to the right) had two windows and a button selection scheme for picking tilesets and backgrounds. To take up less screen area, version 2 (below) eliminated a window, but kept the button scheme. Finally, version 3 (above) switched to pull-down menus to deal with the added tilesets.

    jpg



    Mahjongg Resources:

  • X-mahjongg
  • The Mahjongg Website
  • Just discovered.... BASH tileset builder!
  • Gnome Games
  • Gnome Mahjongg
  • I downloaded many of the tilesets that I resized and converted here from Andy's resource center.

  • Reference and Resources for Tcl / Tk

  • ActiveState's TCL Developer's X-change
  • SourceForge
  • Graphical Applications with TCL & TK by Eric Foster-Johnson (IDG Books)
  • TCL / TK, A Developer's Guide by Clif Flynt (Morgan Kaufmann)
  • Excellent tutorial
  • ActiveState TCL manuals
  • A Google group
  • Brian Oakley's site
  • The TCL'rs wiki
  • Widgets in TK

  • Tikmark Home Page