Matchstick Puzzle

By moving two sticks and the button, try to
make the fish swim in another direction.


This applet is capable of handling any number of matches and buttons, and can be made any size. It is also possible to specify a different matchstick length if necessary. The default length, shown in the example, is 69 pixels. Any desired background color can be specified. I'm using light gray here, to blend in with the rest of the page. The applet will automatically select an appropriate shadow color.

The controls are relatively simple: buttons can be moved around. Matches can be moved or rotated, depending on where you click. If you point at or near the head or the other end, the match will be rotated. Otherwise it will just be moved.

A different example, with just three sticks, slightly longer, no button and no "snapping".
There is a special applet parameter called "snap", set to either "yes" or "no", specifying whether a match should adjust its alignment when dropped. When "snap" is turned on, a rotated match will come to rest at a multiple of 15 degrees. This makes it easier to build squares and triangles. A moved match will come to rest with its head or other end "attached" to the head or other end of another match, if there is one within a short distance.

To clarify, "attached" matchsticks meet at a point slightly outside their physical form, as shown in the picture to the left. This is to ensure that there is enough room for several matches to meet at any corner or junction. The same thing applies to the other ends.

Since this applet has been sold and I no longer own the rights to it, I can't provide any downloadable version. I'm just displaying it here as a source of inspiration to other Java developers.