Jigsaw Logo

Contents

What is Jigsaw?
How do I try it?
How do I get a copy?
More about the program
Known bugs
Program development

What is Jigsaw?

Jigsaw is a Java program and applet. That is, it is a piece of code written in the Java language that you can run either as a standalone program or as a program embedded in a web page. It has some of the features of a real jigsaw: shaped tiles that you can move and rotate that fit together to make a picture. It also has features that make the program reasonably simple. It's designed principally for children of about five to eight years.

How do I try it?

The easiest way to try out the program is to run it as a Java applet by clicking on this link. You will need the Java plug-in from Sun. If you click If you don't have the Java plug-in, your browser should offer to download it when you open the link to the page containing the applet. The Java plug-in is several megabytes in size, so will take time to download.

The applet will take a little time to load and start. I have found it takes up to 30 seconds. When it starts, the jigsaw pieces are scattered round a central area. You have to pick up pieces and place them round the central area to complete the picture. Use the mouse to manipulate pieces as follows.

You can use the Alt and Meta or Ctrl keys to simulate middle and right mouse buttons if you don't have them. Esc returns the selected piece to where it came from.

There is not yet code to check when you've completed the puzzle correctly (Much like a real jigsaw.)

I've tested the applet using Netscape Navigator 4.76 and 6.0 on SuSE Linux 6.4 and Red Hat Linux 6.0 on a Pentium II PC and also using Internet Explorer 5.0 and 5.5 on similar PCs running more popular, but more resource-hungry and less reliable operating systems. I've always used the Java plug-in from Sun, which seems to be necessary to get the Swing classes to work.

How do I get a copy?

There are two ways to get a copy of the program. You can download it as a tar.gz file or as a Java jar file.

If you have downloaded the program as a tar.gz file (recommended for Linux or Unix) you can unpack it with the following commands:

gunzip jigsaw.tar.gz
tar xvf jigsaw.tar

Or if you have gnu tar:

tar zxvf jigsaw.tar

If you have downloaded the program as a jar file (recommended for inferior operating systems) you can unpack it with the following command, which is part of the Java Development Kit from Sun:

jar xvf jigsaw.tar

The program comes as source code. If you don't understand what this means you probably won't be able to follow the rest of this. Compile it with any java compiler that supports Swing, e.g. the Java Development Kit from Sun. To compile it, change to the directory containing the code and type

javac Jigsaw.java

at the command prompt. Alternatively, if you have make, you can type

make jigsaw

The program is compiled in the same directory as its source code. To run the program type

java Jigsaw

Alternatively, use your favourite browser to run the applet in index.html

Note that this program is distributed under the terms of the GNU General Public Licence. This gives you the right to do just about anything you like with the program provided you make the source code freely available to anyone you distribute it to, but gives you no warranty whatsoever about the fitness of the code for any particular purpose.

More about the program

I wrote this program in order to learn Java and to create something that would entertain my five year old son. The tiles are based on pentominoes, which were invented by Sol Golomb. The only difficult part of the program is the algorithm that tesselates the picture into pieces. The rest is simple Java that even an beginner should be able to follow. I have deliberately separated the interface from the code that manages the pieces. So it should be easy for someone who wants to do more with the puzzle to modify the program.

Every public function and every class includes javadoc comments to help identify its purpose clearly.

Known bugs

There are no known bugs in the applet.

There are several bugs in the application, which has more features than the applet:

Program development

I developed this program in spare momements over a period of about ten weeks in order to learn Java - the best way to learn a programming language is to write some code. But I haven't done much with it since. If you'd like to do more with it, please feel free to contact me (J.D.Lamb). Here are just a few of the features that would be nice.

I'm not sure I'll get around to any of these. Some day, when I need to learn GTK, I'll probably translate the non-GUI code into C++ and build a GTK interface on top.


John D Lamb
Last modified: Tues Dec 27 14:57:10 GMT 2000