Download Gerard's Polyomino Solver


What is the polyomino solver?

It is a Java applet I created that is able to solve any puzzle that involves fitting polyominoes in some solution frame. The shape of the pieces and the solution can be defined freely.

Why would you want to download the solver?

Downloading the solver applet gives you the opportunity to define your own polyomino puzzles, and have them solved by the applet. Note that if you just want to run a few of the predefined puzzles, you don't need to download the applet, but can instead run it directly from the Polyomino Solver page.

What are the requirements to run the applet?

You need a Java enabled Web browser. If you're not sure your browser qualifies, try to run one of the solutions on the Polyomino Solver page. To define your own puzzles you need a simple text editor (like TextEdit on the Macintosh or Notepad in Windows), and a bit of patience.

Sounds interesting; how do I download the stuff?

A zip file containg all necessary files is here:

After downloading either file, unpack it; the result is the folderr "PolyominoSolver", which contains all files you need to run the applet. You can throw the downloaded .zip file in the trash; you won't need it any longer.

How do I start the applet?

To start the applet you need to create an HTML file with the definition of the puzzle to be solved. This can easily be done using a simple text editor. Using the editor of your choice, create a file with these contents (you can copy & paste from this page to make things more easy):

<APPLET CODE="Polyomino.class" WIDTH=400 HEIGHT=300 ALIGN=bottom>
<PARAM NAME=PuzzleWidth VALUE=15>
<PARAM NAME=PuzzleHeight VALUE=4>
<PARAM NAME=Piece1 VALUE="true,1,5,0,1,1,0,1,1,1,2,2,2">
<PARAM NAME=Piece2 VALUE="true,1,5,0,0,0,1,0,2,0,3,0,4">
<PARAM NAME=Piece3 VALUE="true,1,5,1,4,1,3,1,2,1,1,2,1">
<PARAM NAME=Piece4 VALUE="true,1,5,0,0,0,1,1,1,1,2,1,3">
<PARAM NAME=Piece5 VALUE="true,1,5,0,0,0,1,0,2,1,1,1,2">
<PARAM NAME=Piece6 VALUE="true,1,5,1,0,1,1,1,2,0,2,2,2">
<PARAM NAME=Piece7 VALUE="true,1,5,0,0,0,1,1,0,2,0,2,1">
<PARAM NAME=Piece8 VALUE="true,1,5,0,2,0,1,0,0,1,0,2,0">
<PARAM NAME=Piece9 VALUE="true,1,5,0,2,0,1,1,1,1,0,2,0">
<PARAM NAME=Piece10 VALUE="true,1,5,0,1,1,1,2,1,1,2,1,0">
<PARAM NAME=Piece11 VALUE="true,1,5,0,0,0,1,0,2,0,3,1,2">
<PARAM NAME=Piece12 VALUE="true,1,5,0,2,1,0,1,1,1,2,2,0">
<PARAM NAME=AFPInSmallest VALUE=false>

Save the file you created as "Run4x15.htm" in the "PolyominoSolver" folder. Now open this file in your Internet Browser, using the "Open" command in the "File" menu. If you did everything correcty, a window appears in which the 4 x 15 pentomino puzzle runs.

What do the lines in the HTML file mean?

These lines, as you probably have guessed, contain the definition of the puzzle as well as the commands to start the applet. To define your own puzzle, you need to understand the lines that contain "<PARAM NAME=... VALUE=...>" . Each of these lines contains a puzzle parameter with the name specified after "NAME=", and a value specified after "VALUE=". Here is an explanation of each of the parameters.




Defines the format of the specification, and must always be 2.


The width of the smallest rectangle that completely surrounds the solution. The width is measured in unit squares.


The height of the smallest rectangle that completely surrounds the solution. The height is measured in unit squares.


The number of pieces defined in the next lines.

Piece1, Piece2 etc.

There is one parameter for every piece, which have to be numbered from 1 upwards to the number of pieces. The value of the parameter consists of a number of subparts, separated by comma's:

  • true / false: Indicates if turning over the piece is allowed (true) or not allowed (false). Note that the solver only flips the piece if it is allowed to do so AND if it yields a shape that is different from the original piece (so for example the "T" pentomino will never be turned over, even if it is allowed).
  • A number indicating how many copies of this piece are available (with a minimum of 1).
  • A number indicating the number of squares in the piece.
  • A set of number pairs, defining the pieces shape. The number pairs are (x, y) coordinates, relative to an arbitrary origin.


This is an optional parameter. Its purpose is to define any "holes" in the solution frame that are excluded from the area to be covered. It contains a series of number pairs; each pair is an (x, y) coordinate of a unit square. The coordinate of the lower-left square of the smallest rectangle that completely surrounds the solution is (1, 1).


This is an optional parameter. It defines how often the solver should check for isolated areas within the puzzle that can not be solved for obvious reasons (for example when there is an isolated area with size 33, and only hexominoes are available, then a solution is clearly impossible). This type of checking is rather costly in terms of processing power, so for many simple puzzles (such as the pentominoes) it is better to omit the CheckIsoFreq parameter (or assign it the value 0). For more complex puzzles, like the hexomino puzzles, this option can be very useful. For example, when you specifiy the value 10 for CheckIsoFreq, the check for isolated areas is conducted after placing every 10th piece


Possible values are true or false. Normally, this one should be set to false. When true, the solver examines the situation after putting a piece in the solution, and if two or more disjunct areas are present, it solves the smallest of these areas first. When set to true, it implies a CheckIsoFreq of 1 (and the value specified for CheckIsoFreq is ignored). Using this option costs a lot of extra processing time.

Note that in the above HTML code an area is defined for the applet to run in. This is done by specifying a width of 400 (pixels) and a height of 300. You are free to change these numbers. The applet will adapt the size of its drawing to the size of its assigned area.

How do I know if I should use the parameters "CheckIsoFreq" and "AFPInSmallest"?

You won't need them for any of the pentomino puzzles. If your puzle is more complex (has more pieces), chances are the solver won't find any solutions for a long time. If this is the case, choose the option "Update display manually" in the solver window. This shows you the pieces actually placed so far in the solution. You can refresh it by clicking the "Refresh" button. If you discover an uncovered area in the puzzle that cannot be filled and doesn't go away for a long time, you clearly need the CheckIsoFreq parameter. Start by setting it to 50 or so, and check again with "Update display manually". If necessary, lower the value of CheckIsoFreq. Sometimes the uncovered area that blocks things is the size of only one piece, and cannot be filled because that piece is already being used in another place. In that case you also need to set AFPInSmallest to true.

Note that setting CheckIsoFreq to 1 and AFPInSmallest to false is a bad choice: if CheckIsoFreq is 1 you might just as well set AFPInSmallest to true, because the extra procesing time is used anyway.

Where can I find more examples of puzzle definitions?

Check out these files: RunP59.html and RunP66.html. The former contains definitions of the pentomino and tetromino pieces; the latter defines the 35 hexominoes.

Be aware that not all of the puzzle definition files on my site are good examples; as a matter of fact many still use an obsolete format of the puzzle definition syntax, which has been replaced by the format described here.