home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Crawly Crypt Collection 2
/
crawlyvol2.bin
/
games
/
biglife3
/
biglife.doc
next >
Wrap
Text File
|
1993-12-20
|
20KB
|
519 lines
BigLife Version 3.00
====================
A life player for big patterns
Copyright © 1993 Owen Rees
Permission to use, copy and distribute BigLife is granted, provided that
any distribution includes the .PRG .RSC and .DOC files in their original
form. A moderate charge may be made for media, duplication, transmission
etc.
Distributors may use their own judgement about how many patterns to
include.
0) Contents
1) How to use Biglife
2) File formats
3) What is 'Life', further reading, more patterns
4) About the author, acknowledgements, history, future etc.
1) How to use Biglife
It's a GEM program and I have tried to make the menus and dialogs easy
to understand so that, if you want to, you can try it out without
reading any further.
BIGLIFE.RSC must be in the current folder when you run BIGLIFE.PRG, keep
them in the same folder to run from the desktop.
When it is loaded you get a GEM window with all the usual controls, and
a menu bar. Here is a summary of the menu items followed by more
detailed descriptions.
Desk: About life... Version number, data about the current pattern.
Desk accessories, if any.
File: Clear Clear the universe.
Revert Revert to loaded pattern.
Load Xlife... Clear universe and load Xlife file (formats below)
Save Xlife... Save universe as Xlife file (formats below)
Load IMG... Clear universe and load IMG
Save IMG... Save as IMG
Quit For when you have had enough
Actions:Go Run at selected speed until key press
Step Do one generation
Redraw Clear window and redraw pattern
Centre Move centre of window to centre of pattern
Reset counters Zero the generation and time counters
Options:Display... Dialog to set the display style
Speed... Dialog to set the speed limit
Rules... Choose rules for life variants
Edges... Set edges of universe
Show Info Show generation number in title line
About Life...
Tells you:
the version number of the program and the name of the author,
the name of the current pattern, ) editable fields
the 'owner' (creator) of the pattern ) see File format below
the first three comment lines )
the cell count, generation number, the run time, average speed and
average time to compute a generation.
the size and position of the pattern
the size and position of the window (in cells)
the size of the workspace and how much is in use: sizes of current
and previous patterns are given separately.
In Low resolution some of the information is omitted, and none of the
fields are editable (so that you don't accidentally lose half the
information.)
Display dialog:
This lets you select the cell size for display, the cell and background
colours and the function used to draw the display.
There is a selection of cell display sizes in two shapes so that you can
choose reasonably square cells in low, medium or high resolution. This
affects how much of the pattern you can see but not the pattern itself.
The squash factor determines how many life cells are mapped to each
display cell. This allows you to see the overall shape of large
patterns. The number is the length of the side of the square that maps
to each display cell. For example, at squash factor 2, you see twice
the width and twice the height but with less detail.
The colour stuff is really just for fun. The one with the black spot in
the middle is the selected colour. I have only given you eight of the
low res colours - you can only use two at a time anyway.
The VDI and LineA buttons select which function gets called to do the
output. LineA is slightly faster but Atari has declared it obsolete.
For the technically minded, the choice is between the VDI vrt_cpyfm
and the Line A bitblt.
Speed dialog:
This sets a speed limit, measured in generations per second. Max means
as fast as possible and if selected BEFORE you select Go will disable
all the controls until you press a key on the keyboard to stop the
run. With any other speed, the menus remain active. If you select Max
while running, the menus remain active so you have to select Go again
to get full speed.
Note that this is a speed limit rather than a delay between generations.
All speeds above the speed at which the pattern can be computed are
equivalent. The time taken to compute the new generation is subtracted
from the delay.
Rules dialog:
The rules dialog lets you specify the birth and survival rules. Select
which neighbour counts should cause a birth in a dead cell, and which
neighbour counts should cause survival in a live cell. There are
buttons to set the dialog to the standard rules and to the 3-4 rules -
one of the better known variations.
Edges dialog:
The edges dialog lets you specify smaller universes, with either open
or connected edges. All cells beyond an open edge are permanently
dead. A connected edge acts as if it were next to the opposite edge of
the universe. By connecting one or both pairs of edges, the universe
can be made cylindrical or toroidal. Specifying 'no edge' is
equivalent to open edges at -32767 and 32767 except for the way scroll
bars operate. Specifying edges slows things down.
Window controls:
The close box does the same as Quit in the File menu. The title shows
the name of the loaded file and, optionally, the number of generations
since load (or counter reset). The generation counter will be updated
dynamically if there is enough time. The full box, size box and move bar
do the usual resizing and moving.
If edges have been specified, the scroll bars show the size and
position of the window relative to the universe - it can be hard to
find a small pattern in a large universe with edges turned on.
If 'no edge' has been specified, the scroll bars show you the size and
position of the window over an area that includes the pattern plus a
border the height/width of the window, and also includes the window
itself. This may sound a bit odd but try loading the glider, scrolling
the window so that it is in the top left corner (you need the border
to be able to do that) then let it run for about 10 seconds at maximum
speed. The glider crosses the screen and disappears into the distance.
When you stop it, the scroll bars show that you are looking at the
corner of a large area. Scroll the window towards the pattern and the
scroll bars start to get bigger until you get to the pattern again.
If you set a slow enough speed limit, the scroll bars will change
dynamically as the pattern evolves.
Pattern editing:
There is a very primitive and slow pattern editing facility. Pressing
the left mouse button makes the cell under the pointer live, pressing
the right mouse button makes it dead.
2) File Formats
Biglife will read and write the Xlife file format. (Xlife is a freely
available life player for the X Window System.) It will also read and
write IMG format files.
Loading Xlife:
The file consists of a number of pattern sections which are merged to
make the complete pattern. The file, and any additional files from
which patterns are included, are read to form a load script. This
script is then processed to build the pattern. The 'Revert' menu item
rebuilds the pattern from the script - this can take a long time for
some pattern scripts.
Each section starts with a header line that
starts with a '#' followed by a format character that specifies the
format of the section.
Biglife supports the following section formats:
A -- Absolute. The header is followed by lines consisting of a pair of
numbers that specify absolute (x,y) coordinates. For example, a row of
three cells centred on (10,10) would appear as:
#A
9 10
10 10
11 10
R -- Relative. Like absolute but with an offset specified on the
header line. If the offset is omitted it is taken to be 0 0. The same
row of three cells could be specified as:
#R 10 10
-1 0
0 0
1 0
P -- Picture. Each following line down to a line that starts with # or
to the end of the file is interpreted as a scan line of an image
starting at an offset specified on the header line. If the offset is
omitted it is taken to be 0 0. A '*' causes the corresponding cell to
be live, any other character leaves it alone. Note that it does not
force the cell to be dead, the cell may have been specified as a live
cell in another section. It is conventional to use '.' because this
makes it easier to count cells without obscuring the pattern.
The leftmost column has the specified x value, with x increasing to
the right. The line starting #P has the specified y value but is not
taken as part of the picture: y increases down the file. Therefore, y
values effectively start at the specified offset plus one. (N.B. In
biglife versions 1 and 2, the line following the #P was taken to have
the specified y offset. This consistent offset did not matter unless
the input contained both #P and other pattern formats. This offset had
to be corrected for #I to work in the same way as Xlife.)
The row of three in picture format could be represented as:
#P 9 9
*** and this text would be ignored
and this is equivalent to a blank line.
B -- Block. Start of a named block for use with #I.
E -- End of block. End of the block named by a preceeding #B.
Sections between a #B and a #E line form a named pattern. These are
not loaded as part of the main pattern, but may be included by the use
of #I. The pattern name follows the #B, e.g.
#B oscil
#P
..*...
.*.*..
*...**
*...**
*...**
.*.*..
..*...
#E
Pattern block definitions may not be nested. In other words, after a
#B there must be a #E before the next #B. Note that #I may occur in a
named block, and may refer to a block that contains further #Is,
provided that a block does not directly or indirectly include itself.
I -- Include. Include a named pattern with transformation.
A #I is followed by up to 6 values as follows:
#I patname x y rotate flip delay
The patname value must be given: defaults for the other values are
#I patname 0 0 0 1 0
patname - the name of the pattern to be included; this takes one of
the forms
file:pattern the .LIF extension is added to the file name and the
named pattern is loaded from that file.
file as above except that the main pattern from the file is
loaded (i.e. the one outside #B #E).
:pattern the named pattern is loaded from the current file.
x y - the offset at which the pattern is to be loaded; this offset is
applied after the other transformations. In an attempt at
consistency with Xlife, the offset is not applied to sections
introduced by #A. There are no examples of this usage and it
is best avoided.
rotate- the number of clockwise quarter (i.e. 90 degree) turns to
apply to the included pattern; this rotation is applied after
the flip has been processed.
Note that Y values increase down the screen so a cell at (1,0)
will be rotated to (0,1) if the rotate value is 1 - this is
the opposite of the usual sense of rotation in cartesian
coordinates.
flip - if this value is -1, the Y values in the pattern are negated,
otherwise they are left alone. This is the first
transformation applied to the named pattern.
delay - if the delay value is positive, then the include is delayed
for that number of generations. In other words, the rest of
the pattern is run for the specified number of generations
before the included pattern is merged into it.
For example, the file SHUTTLE.LIF contains the named pattern 'oscil'
shown above, and the following three includes.
#I :oscil 12 0 0 1 0
#I still:block 21 3 0 1 4
#I still:block 1 3 0 1 19
The first include causes the pattern 'oscil' to be loaded with offset
(12,0) - it is not rotated or reflected. That pattern is then run for
four generations, and the pattern 'block' from the file STILL.LIF is
merged in with offset (21,3). The merged pattern is then run for a
further 15 generations (i.e. a total of 19 since 'oscil' was loaded)
and another copy of 'block' is merged in with offset (1,3). Since
there are no outstanding includes, the load is complete.
The file still.lif includes the following:
#B block
#P
**
**
#E
Patterns defined with #I can take a long time to load. For example,
the breeder script involves running the pattern for 965 generations
before the load is complete. This took 196 seconds (3 min 16 sec) on
my STe last time I measured it, but it is interesting to watch the
pattern being built up. All the usual controls are available during
the load.
N -- Name of pattern. If specified, it appears in the "About Life..."
dialog. For example, the row of three cells:
#N blinker
O -- Owner. Information about the person who created the pattern. The
form should be: 'id "name"@machine date', which doesn't necessarily
make a lot of sense for a home computer. If specified, this appears in
the "About Life..." dialog too. If I was going to put one of these on
a file I would use something from which you can probably deduce my
Internet email address:
#O rtor "Owen Rees"@ansa.co.uk Mon 15 Mar 1993 21:00
C -- Comment. The first three such lines are saved and appear in the
"About Life..." dialog. Use these for comments about the pattern. For
example:
#C This is a very common oscillator of period two
# -- Another kind of comment. These get discarded. Use these for
comments about the file itself. For example:
## next section is a blinker in relative format.
For compatibility with the original Xlife format, a file consisting
only of lines with coordinate pairs will be read as a single absolute
section.
Saving Xlife:
If the pattern has a name, owner, or comments (as in #N, #O, #C above)
then these will be written to the file (only the first three comment
lines are remembered so only they will be saved.)
The pattern is saved as a single picture (#P) section if it is less
than 72x100, and a single relative (#R) section otherwise.
Loading IMG:
Biglife ignores the pixel size, it just takes each pixel as a cell.
Cells are dead if unset in every plane; this will be white with the
default pallette in your paint program. Biglife takes notice of the
image width and height - not all paint programs do this so be prepared
for problems. Biglife will read multi-plane (colour) images written by
Hyperpaint-II; the format is different from the descriptions I have
seen published, but the descriptions tend to be vague in this area.
Saving IMG:
The pattern is saved as a single plane image at 100dpi with the width
rounded up to the next multiple of 8 and height used as is. I have
successfully imported a saved pattern into PageStream, but there is
scope for a lot of problems here.
3) What is 'Life', further reading, more patterns
Those who are familiar with 'Life' can skip the next bit...
Introduction to Life:
Life was invented by John H. Conway, a distinguished mathematician at
the University of Cambridge. It is a 0 player game; you choose a
starting pattern, the rules determine its successor patterns. The
fascination is that it is very difficult to predict the fate of an
arbitrary pattern, and you can set up patterns that interact in
intricate and complex ways.
The Life universe is like a succession of infinitely large sheets of
graph paper. Some of the squares are filled in, these are called live
cells. Life proceeds in discrete steps, like the separate sheets of
graph paper. Each pattern is derived from the previous one by the
following rules:
Birth: If the cell was dead in the old pattern, but three of its
eight neighbours were alive then it becomes alive in the new
pattern.
Survival: If the cell was alive in the old pattern, and either
two or three of its eight neighbours were also alive then it
remains alive.
Death: If the cell was alive and had less than two, or more than
three neighbours then it is dead in the new pattern.
The other cases are dead cells that remain dead because they do not
have three neighbours.
Terminology:
Most of the conventional terminology was invented by Conway and other
early experimenters. Here are some of the terms used in comments
attached to the patterns, these are adopted from the books mentioned
below:
Still life: a pattern that remains the same in the next generation.
Oscillator: a pattern that reappears some number of generations (the
period) later.
Spaceship: a pattern that reappears in a new position some number of
generations later. The smallest and most common spaceship is the
glider.
Glider gun: a pattern like an oscillator but adding a glider at each
repetition.
Puffer train: a pattern like a spaceship but leaving behind an
'exhaust' which stabilises to still lifes, oscillators, and sometimes
spaceships.
Rake: a combined puffer train and glider gun. A puffer train is
usually considered to be a rake if a large proportion of its exhaust
is spaceships (usually gliders.)
Methusaleh: a small pattern that takes a long time to stabilise into
still lifes, oscillators, and spaceships that will not run into any
other part of the pattern.
Further reading:
"Wheels, Life and other Mathematical Amusements" by Martin Gardner
(Freeman 1983)
A collection from his column in Scientific American, including the two
articles which introduced Life to the general public, as well as a
third chapter on Life written especially for the book.
"The Recursive Universe" by William Poundstone (Oxford University
Press 1985)
This book describes the history of Life, and includes a large number
of patterns. It also includes some interesting excursions into
information theory. The only weakness is in the description of how to
program a life player.
Both those books give quite a few other references.
Patterns:
Biglife supports the Xlife file format so that it can use the large
pattern library that is supplied with Xlife version 3.0. Almost all of
the Xlife library was included (adapted for short file names) with the
original distribution, with a few additions of patterns described in
the books mentioned above.
I have added comments to some of the patterns which you can see using
the "About Life..." dialog. Most of the comments use the terminology
given above.
You should try at least the b heptomino puffer train PUFFRTRN.LIF and
the breeder BREEDER.LIF, if only because Poundstone says they are too
big for a home computer. It took just over 2 hours to track the puffer
to its predictable state at generation 5533 on my STe.
I don't know of any other significant collections of patterns.
4) About the author, acknowledgements, history, future etc.
If you want to tell me how wonderful/awful the program is, you can
send Internet e-mail to <rtor@ansa.co.uk> or write to me:
R. T. O. (Owen) Rees
32 Highworth Avenue
Cambridge
CB4 2BG
England
Biglife was implemented in C using Sozobon2.0 (with some modifications
of my own), GemFast1.8, emacs18.55 and gulam, and I would like to
thank the authors of those programs for making it possible.
Version 1: published on the cover disc of ST Format issue 50
Version 2: uploaded to atari.archive.umich.edu on 12 July 1993.
- IMG file support
- fixes some bugs in the handling of large (>32767 cells) patterns.
Version 3: (December 1993)
- fixes bug: earlier versions can hang when scrolling
- fixes bug: more than three #C lines caused "unknown format" error
- support for #I,#B,#E xlife formats, and revert to loaded pattern
- Squashed display was added
- Alternative rules added
- Adjustable edges added
- speedup: input sorting is done only on the part of the input that
does not arrive in order
- speedup: various code restructuring to shorten critical loops
Version 4? Maybe one day.
I have no idea what it might contain.
Time to stop reading and get on with Life.