Kajongg: True Mahjong at last

Off the Beat: Bruce Byfield's Blog

Feb 28, 2011 GMT
Bruce Byfield

For as long as I've owned a computer, I've been looking for Mahjong game. Not a decent Mahjong game, but any at all. Years ago, I found a monochrome shareware game for DOS, and later I found a Windows game, but both were soon rendered unusable by developments in hardware and software. Nor did I ever find a Mahjong game that ran natively in GNU/Linux -- not, that is, until KDE released Kajongg a couple of versions ago.

I am not talking, you understand, about the matching game that masquerades as Mahjong. That is a game sometimes called Shanghai that uses Mahjong tiles, but has more in common with solitaire or patience than true Mahjong.

You can find versions of the tile-matching game in GNOME as mahjongg and in KDE as kmahjongg. However, the Mahjong that Kajongg offers is a game for four players that resembles gin rummy, with tiles in place of cards. The goal is to collect sets of tiles, usually three or four of a kind, but also rarer, more complicated sets. When all a player's tiles are in a set, the player wins. The result is a game that involves luck but also a strategic awareness of which tiles have been played, a combination that makes the game ideal for gambling.

Played for centuries around the world, Mahjong has a number of variations, most of them involving the exact number of tiles and the sets that players can make. Currently, Kajongg offers only Classical Chinese scoring rules, although it will also allow different rule sets to be added if anybody ever writes them. Similarly, in theory you could play Kajongg on a game server, but for now the only option is for a local game in which the computer plays three players.

Aside from an incongruous default Egyptian-themed wallpaper (which I quickly changed to a Chinese painting), Kajongg closely reproduces a real life game of Mahjong, with players' tiles arranged in a square and discards placed randomly in the middle. The possible moves that you can make at any time are displayed on buttons down the right side of the screen. There is even an option for exchanging comments with other players, although obviously that has no purpose in a local game against the computer.

Since KDE has long had a tile-matching game, four designs are available. However, no matter which one you choose, probably you will want to play Kajongg full-screen, since some of the tiles can be hard to read in a smaller window.

Smoothing Game Play

In general, Kajongg's game-play is reasonable, but Mahjong does have several disadvantages that neither Kajongg or any other implementation can do much to overcome. Now that I think of them, these disadvantages may explain why true Mahjong has never really caught on as a computer game.

To start with, a single hand of Mahjong is not a quick diversion while you're waiting for a friend on IRC to return to the keyboard. You need to keep alert in case you can pick up a discard, and to guess what sets other players might be trying to compete. Although you can pause the game indefinitely when your turn comes around, in general Kajongg is not a game that you can easily leave and come back to. Nor will you want to as you get into the strategy. Consequently, a complete game may take 40-80 minutes to play, depending on the luck of the tiles and how carefully you think before acting.

Not much can be done about the time Mahjong takes, but Kajongg is generally effective in speeding things up. For example, while Kajongg's artificial intelligence seems to be reasonably speedy, although each computer player can take as long as twenty seconds to make a choice, especially later in the game when the tactical options increase. The time will be even longer due to the time you have after a discard to think about picking it up -- at least, until you notice that clicking the No Claim button ends this waiting period.

Even more importantly, although some sets are easy to see, others are more obscure. As a result, you need to know the rule book unless you want to spend several minutes mulling over each move. At least for the first few games, you may want to have the online help open -- or, better yet, printed so that you can view it quickly while keeping one eye on the screen.

You might also want to heavy use of the various dialogs that explain scoring in the View menu, both during play and at the end of each hand. This information will not only help you to make your moves, but also help you to learn the sets you can build during play.

A long-awaited game

If this description sounds like Kajongg is not for everyone -- then you're right. Mahjong has an involved set of rules, and takes far longer to learn that games like Gweled or KBreakout.

However, like all of the games in the KDE 4 series, Kajongg features gorgeous visuals. Even more importantly, it does everything possible to speed game play and to help you to learn the rules.

Kajongg may not be as enjoyable as having friends over for Mahjong and drinks. Personally, too, I would enjoy it more with Hong Kong scoring, partly because those are the rules I prefer and partly because Hong Kong scoring includes more complex tile sets. Still, I confess that Kajongg has wasted more hours for me than I care to admit, and for that I am as grateful as I am guilty.

Comments

  • Thank you

    for writing about Kajongg!

    I'd wish to have know about your article sooner... (I am the author of Kajongg)

    Just a few remarks:

    the server option is fully implemented, this is not only theory. The only thing needed is that somebody starts the server (kajonggserver) on his computer and makes its port accessible from outside. So if you want to play against a combination of 2 robot players and myself - just tell me!

    there is no option to exchange comments with other players, it is not even planned, There are so many excellent chat programs. However if you record voice files as described in the manual, the other players will hear your claims and your discards just like in a real game. This also makes it nicer to play against the computer. Preinstalling voices is planned but I would need at least 3 english speaking people to record them (hint...) (a mix of male/female would be optimal). I am native german but if needed I would speak the 4th voice.

    the delay of 20 seconds for thinking is configurable - not in the general options but in the ruleset (options) because each player should use the same value within one game for fairness.

    I am not sure which version you tested - I changed the default background from egyptian to light wood in September 2010

    xmj (mentioned by David) has one advantage: its robot players are much more intelligent. xmj is written in C or C++ (don't remember), but Kajongg is fully written in Python - and it is not that easy to implement good AI in a slow scripting language.

    Regards

    Wolfgang
  • KDE KMahjong

    I downloaded KDE games like I do with every distro and the game there is KMahjong not the one you are talking about.

    How do you install Kajongg?
    Where you find it?
    its not in the repos.

    if its part of the KDE games, why isnt it available to download?


    If you build it, they will come... BUT ONLY if you give them directions on how to find it.

    Interesting article but totally useless for a semi-newbie. (I can do the kpackagekit thing and copy-paste sudo commands)
  • Re: typo?

    Whoops! Thanks for catching this. I've corrected it now.
  • Mahjongg in Gnome Games

    Kahlil Moonwalker Mar 02, 2011 12:18am GMT
    Mahjonng is included in the Gnome Games package....

    No, that's the tile-matching game that goes by the same name, not the four-person game I'm talking about. Thanks, though.
  • Gnome

    Mahjonng is included in the Gnome Games package....
  • kajongg

    You could have tried xmj. Its a server and client mahjongg game which I have ben using for a couple of years now. It's included in Linux Mints repositories and can also be found here: http://mahjong.julianbradfield.org/

    Hope that helps

    Regards

    Dave Le Huray
    Guernsey
  • typo?

    hey, I think you lost part of a sentence at the end of the 2nd paragraph.
    cheers!
comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News