Category 'Klaverjassen'

An effort to bring the game of Klaverjassen to mobile phones: files are here, sources are here.

Download now!
Version: M4 (10 August 2008).
Announcement; download JAD; JAR.

Also, a PC version can be launched here.

Klaverjassen — now with Bluetooth!

After a day of pretty heavy programming, I am proud to announce a new version of the Klaverjassen game, now with Bluetooth support. Just in time for my train trip to the Sziget festival next monday :)

The new version (JAD, JAR) lets you choose between server, client and standalone mode. In server mode, one gets a list of all connected clients, and one can change their ordering by using the “Up” and “Down” menus. In client mode, one just has to wait for the server.

All remaining places are filled up by computers. The server player is responsible for pressing any key to let the computer player make a move. For the rest, the gameplay remains unchanged.

ChangeLog:

Milestone 4

* Bluetooth support!
* Now play with “0″, pass with any other key
* Changed layout/player names to facilitate smaller screens

Some notes on my implementation follow when I am less tired..

Klaverjassen M3 — it’s there!

After spending some time on the PC version of my Klaverjassen game, today I transferred the improvements to the mobile version, releasing version M3 (JAR, JAD). Basically, this means that it now features the still-dumb-but-not-quite-random AI of the PC version and improved game logic.

The user interface

Also, I wrote a new user interface. It is not perfect yet, but it looks pretty OK on my mobile phone’s QVGA (240×320) display. Smaller displays probably won’t work too well. Some screenshots (from the Sun Java mobile phone emulator):

Let me explain the UI. In the left-upper corner of the screen, the game number and the person starting in this game is shown. After every change in the situation of the game, the game pauses and one has to press a random key. For instance, this is after each card played by the computer, or after each play/pass decision.

In the left screenshot, the user (”Ik”) has to choose whether to play on clubs (”Klaveren” in Dutch), displayed just below the game number. In this case, I chose to play (by pressing the “3″ button of the phone — any other key would be passing), so “Wij op K” is displayed, meaning that we are playing on clubs.

Now, I choose to play the ace of spades by pressing the “4″ button. The other players also play some cards, and I win with 29 points, as shown in the right screenshot. And so on, and so on.

Changelog and technical details

Here is the changelog:

Milestone 3 (07-08-2008)
————————
Game logic:
* [FEATURE] Base play/pass decision on cards
* [FEATURE] Simple heuristic AI
* [FIX] Reset extra points counter after game
* [FIX] Rebuild of game class in pull based fashion
* [FIX] Don’t use Integer.compareTo(), @override in game logic
* [FIX] New trump can’t be the same as old one
* [FIX] Don’t use floating point numbers: not supported by CLDC 1.0
* [FEATURE] Added field showing first player in current showdown
User interface:
* [FEATURE] Brand new, graphical UI

The game, as far as I know, uses only CLDC 1.0 and MIDP 1.0 features, so it ought to work on any Java-enabled phone. I only tried it with resolutions of 240×320 and larger; smaller screens probably won’t work too well. I’d like to hear your comments!

Klaverjassen — PC version

To find out something about strategies, I did a PC version for my Klaverjassen game. Features:

  • Play Klaverjassen against a (not very smart) computer AI
  • Keep scores of games and total score

I did a very lazy attempt at an AI so it isn’t really smart yet (stay tuned for updates on this topic), but at least it should be a bit better than the previous mobile AI, which was completely random. A small screenshot:

I know the game logic isn’t completely correct yet — sometimes an illegal move is allowed or even forced, but I hope for your comments on fixing it. Also, rather than the game just going on and on, I am planning to build “pause” functionality later.

For now, the game can be launched using this link (Java Web Start); the file can be downloaded here. Stay tuned as I port the improvements in the game logic to the mobile version!

Klaverjassen, M2

Update: now that the UI is fixed a bit, the game works a lot nicer on an actual phone (that is, my brand new Nokia)… So I announce Milestone 2 (JAD, JAR). Changes:

Milestone 2 (08-07-2008)
  • FEATURE: Only show cards that player hasn’t given away in hand
  • FEATURE: Compress all status text into one field
  • FEATURE: Also calculate “pit”, score-divided-by-10
  • FIX: 3-in-a-row and 4-in-a-row roem calculations didn’t work
  • FIX: troef 10 and troef A would be seen as equally high
  • FIX: do not allow playing one card multiple times
  • FEATURE: Reset move textbox after playing

And here are the screenshots I promised:

Still some issues remaining, particularly when the game lets you play moves that are really not allowed :)

Klaverjassen for your mobile phone!

As a summer project, I was working a bit on Klaverjassen for mobile phones, and the first technology preview Milestone 1 is here!

You can already play the game (though it has a few glitches, see here). Screenshots and so on will follow. There are various improvements that need to be made:

  • UI – Currently very bad. Putting all status text in one text box would greatly increase the usability (and this will probably be done in M2)
  • Computer AI – Currently the computers act completely randomly. Some heuristics could be easily implemented to make it about as good as some online implementations (also look at an open source belote game: how is it done there?), but my final goal is to have a real AI which precalculates moves and so on
  • Multiplayer – Play together with Bluetooth — this would be great
  • Other platforms – A PC version or a Java applet would probably be pretty easy to make
  • Other game variants – There are many different sets of rules used, maybe support multiple variants (particularly, not having to declare roem or having roem in the hand as with toepen would be nice).

If you have any remarks on what you would most like to see changed in the game, or bug reports or indeed any comments at all, please mail me!

Oh, and source code is here..

Categories