Sample polyominoes
I have recently got into writing programmes in Microsoft Visual Basic Pro - just for
fun really as it twists the neurons in ways that are quite different from normal life!
About 5-6 years ago I wrote a programme on an old Amstrad PCW for a friend. The basic idea
is quite simple - how many different shapes can be made from a given number of squares
that are only allowed to touch each other along their sides (i.e. a corner cannot be the
only point of contact). Any mirror image or rotation of each shape must not be counted as
they are just the same shape moved in space in some way. Figure 1 shows all of the
possible combinations for 1, 2 and 3 squares after this the number of patterns increases
dramatically and some of them can be quite pretty. The Amstrad is a curious beast as
Mallard Basic (the free Basic interpreter provided with it) had some very powerful
routines for writing indexed databases - something that's usually a bit tricky in Basic.
Anyway I wrote the programme but discovered that the number of combinations gets pretty
large and beyond about 11 squares I ran into severe problems of (1) speed - it's a bloody
slow computer, and (2) disk space - limited to about 700kb as it doesn't have a hard
drive. The initial (rather poor) solution was to get a CP/M emulator for my 486dx4-100 and
run the Amstrad programme under that - this worked but was still terrifyingly slow as the
emulator seemed very keen on emulating not only the instruction set but also the SPEED of
a Z80 processor... Anyway to cut a long story short I have ported the programme across to
Visual Basic and it now works a lot faster but there are some unexpected bugs due to the
fact that the Microsoft Access database format is much less flexible than the Jetsam
database used in Mallard Basic. The main problem is that it seems to have difficulty
dealing with indexes composed of 8-bit characters (I use all 256 ASCII codes to encrypt
and compact each shape into the database). I'm working on this and when I get it fixed
I'll post the first beta version of Polyominoes for Windows here.
So I guess only two questions remain:
Well this is easy really - because it's quite a complex programme
to write and the person who set me the original challenge used to sit up all night with a
friend trying to draw them out on graph paper and so I said that a computer could generate
the patterns rather faster and more accurately. It can - but only up to 11 squares on an
Amstrad before it develops brain-lock (but the graph paper approach never got past six).
Well that's just what I was told these shapes are called!
My next project will be to see if I can figure out a mathematical relationship between
the number of square in the shapes and the total number of patterns that can be generated.
In theory this must be predictable but I guess it would help to know how many patterns
there are first!
Edward James Oakeley