Chinese Checkers Java Game
Chinese Checkers is an old game (over 100 years),
but somewhat unique because it uses the hexagonal grid rather than the traditional square grid.
This adds an element of complexity for the programmer because computers tend to think in squares.
How to Play the Game
The coloured dots on the left hand side allow you to select how many players are
in the came and which colours they will be using. Changing this selection at any
time will reset the game to the start. You can play with a mix of human and computer AI
players or just let the computer run against itself.
Drag the pieces to their new positions. Note the small, white stars help indicate
what are the legal moves.
First player to the other side is the winner and then the game is over.
Start again by toggling the coloured dots on the left hand side.
The AI players utilise a brute-force shallow and greedy search
algorithm with a few special weightings thrown in to give it some approximate sense
of strategy (this is just a vague strategy, it has no lookahead). Some additional
random element is added just for amusement sake to make it less boring.
Strategy Suggestion
Obviously, long moves are better so search for long moves (the small, white stars help
make it easier to see the moves). Try not to let pieces get left behind because once
they are left on their own they move very slowly. It is good to organise your pieces
into a pattern to get repeated long runs, however other players will mess up your
pattern by jumping into the middle of it, so don't try too hard to set things up
for a future long move.
Going out wide can pay off, especially if the center of the board is crowded. But the
center clears out surprisingly quickly towards the end of the game and pieces out
on the edges run the risk of being stranded with nowhere to go.
History and Patents
As with a great many things that you didn't expect were patented, the Chinese Checkers
game was patented (according to this
history of the game) in Germany, in 1892, calling it "Stern-Halma". The earlier
game "Halma" was set on a square grid instead of a hex grid (in Halma the pieces have four
possible directions to move, in Chinese Checkers the pieces have six possible directions)
so the game dynamics are different. Here is
another history of the game, with board photos.
Since then (for whatever reason) Halma has fallen into disregard and Chinese Checkers
(which never was Chinese) has become the classic hopping piece race game.
Related links
To Download The Game (and Source)
Download the JAR file and you can run the game as an application
on your own machine (without this web page). Unzip the JAR to see the source code.
Running as an application lets you resize the game board to fit your screen.
This program is released under GPL so you are
granted the freedom to copy and modify the source.
UPDATE: 2012-04-22
Earlier versions of the program don't work anymore because Java engines have changed over the years,
if you want to download the earlier version it is in this JAR file from 2008
but it only works on old JVM's (like 1.4 and earlier I think). In particular, the earlier version
used a feature that allowed "byte" types to work as unsigned under special cases (i.e. can access
numbers bigger than 127) but they appear to have cracked down on that, so it crashes with an exception now.
Also, a bunch of things like type checks for generics have been introduced and the command line
for the JAR program is different (as far as I can see only "jar cfm ..."
actually reliably works to build jar files, not a place to get creative with options).
Index of Java Games