Application Series 21
But the thing that interests Dave is how many shapes polyominoes can take. 'The first two, square and domino, have only one possible shape, however once past this level the number of possible shapes begins to increase, quite rapidly' Dave said 'The hope is to be able to predict exactly how many shapes there will be for an n-omino'.

If the original shape is symmetric then it is only necessary to test some of the positions as the others will be duplicates. Symmetry is checked by counting the number of times that a rotation or reflection fits on top of the given shape.
The coordinates of the centres of the squares were converted to letters of the alphabet in pairs. The first square would have coordinates (0,0) which would become AA a domino (0,0),(0,1) would become AAAB and so on. The string was then stored by hashing it into a large array. 'Now the whole array does not have to be searched only the entries around the point generated from the hash algorithm need checking' Dave explained. Collisions were coped with by keeping a note of the maximum distance moved in order to store a colliding element and then searches only moved that distance from the target location.
Each time a new coordinate string is stored it is also written to a file as a permanent record. This file can be read in order to generate the next size polyominoes. By late 1995, files exist for all polyominoes up to order 15. 'The job to create the 15s from the 14s started at 14:16:47 on the 9th May and finished at 04:08:00 on the 10th May using an 8 processor Sun Sparc 1000. Compare that to the original' Dave said proudly.
Unfortunately this is the largest job that can be run this fast on the machines Dave has available as it is necessary to hold the array in memory to achieve this sort of speed and the next size would need more than the maximum real memory.
Once a version was running with HOST the next thought was of trying SIR's 4GL language, PQL, to compare with the HOST version. Using subroutines the program generally converted with ease to PQL. Development time was significantly shorter in PQL although run time was longer with the 4GL, as expected.

To solve the question of predicting the number of n-omino shapes, Dave graphed the ratio of numbers of n-omino shapes to those of (n-1)-omino shapes:

This ratio seems to be approaching 3.8. This can therefore be used as an approximation to the number of polyomino shapes of the next size.
For more information on the use of SIR with mathematics contact:
Dave Doulton
Computing Services
University of Southampton
Highfield
Southampton SO9 5NH UK