Little Game "Hexen hexen"
04.07.07: A stupid bug in the applet fixed!
One day I searched through some stuff from my childhood in order to find some toys for my nephew when I came across a small dexterity game I played when I was young.
You play it alone. It consists of following 9 cards:
(Sorry that they
all differ in their brightness.) Goal is to place the nine cards into a 3x3
square so that the little witches match (means a back and a front part of a
witch in the same color 'touch'). In those days it was quite difficult for me
to solve it. So I tried it again (nearly fifteen years later) and well... it
took some time :-)
So I thought why not let it other people solve so I made quickly a dirty-coded applet where you can try it yourself... so have fun!
The Applet (requires at least Java JDK 1.6.0; is about 110kb so will take some time to load depending on your connection)
Usage: With the left mouse button you can drag a card to an empty block in the grid. Of course you can drag an already placed card out of the grid too. By pressing the right mouse button on a card you rotate it by 90 degress clockwise. So try your best!
By the way I noticed
that I forget to include a button for restarting the game. So if you have solved
it and want to play again you have to reload this page. Sorry for this but I'm
too lazy to modify it...
Solutions: The package of the game stated that there are exactly
two distinctive solutions. Of course that was an incentive for me to check if
there are not even more! So I coded a little bruteforcer (well, more a backtracking
algorithm) which gives me all solutions. When I first get it to run properly
I was quite excited cause it printed 8 solutions! But unfortunately in fact
there were just two different solutions cause every four solutions were equal,
they just differed symmetrically.
I didn't change the program, so it still gives you eight solutions but it's obviously to find the two really different solutions.
The backtracking algo is quite fast cause there are just at most 9! * 4 = 1.451.520 different possibilities to check. (9! possibilities to place the nine cards on 9 places and the four comes from the fact that you can place a card in four different ways, always rotated by 90 degress.). The algorithm just tests a fraction of all possibilities, in fact just about 15.000 to find all solutions!!!
Here are 2 screenshots
from the two valid solutions:
Download: <HERE> (includes applet, backtracking tool, this site and of course all sources; 790KB)
This site is part of Sunshine's Homepage