home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
618a.lha
/
FastLife_v1.1
/
FastLife.doc.pp
/
FastLife.doc
Wrap
Text File
|
1992-03-03
|
21KB
|
602 lines
1m32m
F a s t L i f e
0m
by
1m33m
R o n C h a r l t o n
0m
Version 1.1
04-Jan-1992
FastLife is an Amiga implementation of Conway's Game of Life.
FastLife may be freely distributed.
1m32m
C r e d i t s
0m
o Intuition Interface and Integration by Ron Charlton
o Blitter Life Routines by Tom Rokicki
o CPU (680x0) Life Routines by Olaf Seibert
o Simple Requesters by Steve Tibbett
o ARP File Requester by Charlie Heath
o Menus generated with MenuC by Bruce Mackey
1m32m
Q u i c k S t a r t
0m
1. Double click on the FastLife Icon
2. Select the "Control-Run" menu item
33mor0m
1. Double-click on the FastLife Icon
2. Select "Project-New" menu item
3. Select "Project-Open" menu item
4. Type "acorn.life" (without the quotes) and press <return>
5. Click in the center of the screen
6. Select the "Control-Run" menu item
1m32m
F e a t u r e s
0m
o Menu-selectable Calculation Mode (CPU or Blitter)
o High Speed Blitter mode on Amiga 2000/500/1000 (19 generations/sec.)
o CPU mode for Amiga 3000 or accelerator (35 gen's./sec. at 25 Mhz)
o Automatic fallback to CPU mode when memory is low
o Four screen sizes
o Full Intuition interface
o Runs under Workbench 1.3 and 2.0x
o Runs from Workbench and CLI
o Uses Heath File Requester (if you have arp.library)
o 153 Life patterns in text file format
1m32m
T h e G a m e o f L i f e
0m
In 1970 John Horton Conway, a mathematician at the University of Cambridge,
invented the game of Life. It was introduced by Martin Gardener in his
October 1970 Scientific American column. Conway's goal was to create a
board "game" with simple rules that would exhibit complex behavior. The
game is played on an infinite checkerboard, or grid. Each square, or cell,
is either alive or dead (ON or OFF). Time moves in steps; each step marks
the life of one generation.
Each cell's condition (ON or OFF) in the next generation is based on the
life in it and its eight neighboring cells. For example, the cell
represented by the asterisk (*) below has eight neighbors -
123
4*5
678
There are three rules concerning the neighbors state in the next
generation:
1. If there are 2 ON neighbors the cell stays ON or OFF
2. If there are 3 ON neighbors the cell is ON
3. 0, 1, 4, 5, 6, 7 or 8 ON neighbors the cell is OFF
The analogy to real life: too many neighbors and the cell dies from
overcrowding, too few neighbors and the cell dies from loneliness. Three
cells results in trisexual mating.
The ON/OFF state is determined for all cells on the board before changing
to the next generation.
Many computer versions of Life have one pixel on the screen represent one
cell on the board, as does FastLife. The screen resolution determines how
many cells are available in FastLife, so the board is not truly infinite as
defined by Conway.
An excellent reference for learning more about the history and
philosophical implications of Life is
33mThe Recursive Universe0m by William Poundstone,
Contemporary Books, Chicago, 1985
The book consists of alternating chapters about Conway's game of Life and
modern physics, and what the game of Life can reveal about the beginning of
biological life and its replication.
1m32m
A b o u t F a s t L i f e
0m
The desire to combine the speed of Tom Rokicki's blitter Life routines with
an Intuition interface and access to many of the classic Life patterns led
to the development of FastLife. Olaf Seibert's 32-bit CPU (680x0) mode
allows the CPU to take over when there is insufficient memory to use the
blitter or when your Amiga's CPU is faster than the blitter.
The storage format for the Life patterns supplied with FastLife is a simple
text file (see File Format below). Although FastLife does not allow
on-screen editing of Life patterns, you may use your favorite text editor
to create text file patterns to load into FastLife.
Conway defined an infinite board for Life; FastLife limits itself to the
screen size of the Amiga (320 by 200 to 640 by 400). Patterns that spread
to the edge of the screen will be "eaten" away there, so you should be sure
that you select a screen size that will contain the entire pattern you want
to view. This corruption of the Life pattern at the edge of the screen is
not detected by FastLife; you must observe for yourself when this happens
as Fastlife runs.
FastLife ALWAYS calculates the entire screen, unlike some other
implementations of Life. Calculation speed is not dependent on how many
cells are ON or OFF, but only on the screen size and whether the blitter or
CPU is used for calculation.
1m32m
C h o o s i n g a C a l c u l a t i o n M o d e
0m
Fastlife can use the blitter or the CPU to calculate each generation. The
only difference is how fast the next generation is calculated and how much
memory is used. I have tested Fastlife on a stock Amiga 2000 and an Amiga
3000/25; the results are shown below. The Amiga 2000 results should be
valid for the Amiga 500 and Amiga 1000 also.
If your Amiga is not listed, or you have an accelerator, you can run a
simple test to decide which mode is fastest on your Amiga. The test is
described later under "Which is Faster?"
You may change the calculation mode in several ways:
CPU mode -
Menu Item CalcMode-CPU
Right-Amiga-C key
C key
Add any argument to the Shell/CLI command line
Blitter mode -
Menu Item CalcMode-Blitter
Right-Amiga-B key
B key
No arguments to the Shell/CLI command line
1m32m
F a s t l i f e S p e e d a n d M e m o r y
0m
FastLife memory usage and speed vs. screen size and calculation mode on a
stock Amiga 2000 (68000 at 7 MHz) and a stock Amiga 3000/25 (68030 at 25
MHz):
Screen Calc. Memory Generations
Size Mode CHIP TOTAL per Second
------- ------- ---- ----- -----------
320x200 68030 18K 63k 35.0
320x400 68030 34k 79k 18.0
640x200 68030 34k 79k 18.0
640x400 68030 66k 111k 9.0
320x200 blitter 50k 95k 19.0
320x400 blitter 98k 143k 9.5
640x200 blitter 98k 143k 9.5
640x400 blitter 194k 239k 4.7
320x200 68000 18K 63k 5.5
320x400 68000 34k 79k 2.7
640x200 68000 34k 79k 2.7
640x400 68000 66k 111k 1.3
So -
blitter speed = 4 times 68000 ( 7 MHz Amiga 2000)
blitter speed = 1/2 times 68030 (25 MHz Amiga 3000)
and for each screen size -
blitter mode CHIP memory = 3 times CPU mode CHIP memory
blitter mode total memory = 2 times CPU mode total memory
33mNote:0m The CPU calculation mode is slowed greatly if FAST memory is not
available. For example, no FAST memory will slow the 320x200 68030 rate
from 35 to 14 generations per second!1m32m
S t a r t i n g F a s t L i f e
0m
You may start FastLife from Workbench by double-clicking its icon. You may
request FastLife start in either CPU or blitter calculation mode by setting
an icon ToolType. To set a ToolType click once on FastLife's icon and use
the Workbench menu to select Info (Workbench 1.3) or Information (Workbench
2.0). Enter the appropriate ToolType:
CALCMODE=BLITTER
or
CALCMODE=CPU
Finally, select Save. FastLife will then start in the selected mode if
enough memory is available.
You may also start FastLife from the Shell or CLI by typing
1> FastLife
or
1> run FastLife
If you add anything to the end of the CLI command FastLife will use the CPU
rather than the blitter when it starts. The command would then be
1> FastLife frog fuzz
or
1> run FastLife frog fuzz
1m32m
U s i n g F a s t L i f e
0m
When Fastlife starts it will open its default screen (320 by 200 pixels),
which is its fastest. FastLife will use the requested calculation mode
when sufficient memory is available. If sufficient memory is not available
Fastlife will automatically fall back to the CPU mode.
FastLife will initially display its name on the default screen. You may
select menu item Control-Run and see FastLife run for over 3100 generations
before the pattern becomes stable. Or you may immediately select menu item
Project-New to clear the screen.
If you use the menu to request a new screen size FastLife will try to give
you that size, but if memory is not available it will fall back in the
following order:
1. Requested screen size with requested calculation mode
2. Requested screen size with CPU mode
3. Default screen size with requested calculation mode
4. Default screen size with CPU mode
In the worst case no screen will be provided and FastLife will exit with an
error message.
If you can't get the screen size and blitter/CPU mode you want, try closing
other screens, windows and projects/tools to free up memory. You may even
want to reboot your Amiga in case memory has been fragmented by other
programs.
You can use the Left-Amiga-N and Left-Amiga-M key combinations to expose
the FastLife screen or hide it behind the Workbench screen. You can also
click in the small FastLife window on the Workbench to bring FastLife's
screen to the front. (Also see the Project-ScreenToBack menu item.)
1m32m
M e n u s a n d K e y b o a r d S h o r t c u t s
0m
FastLife has the following menu selections:
Project
New <N>
Open <O>
Open Again <A>
About
ScreenToBack
Generation
Show
Reset
Screen Size
320 x 200
320 x 400
640 x 200
640 x 400
Priority
Lower
Normal
Higher
Quit <Q>
CalcMode
Blitter <B>
CPU <C>
Control
Once </>
Speed
Run <R>
Stop <S>
The menu items are:
Project-33mNew0m - "New" clears the screen of ON cells in preparation for a
new pattern.
Project-33mOpen0m - "Open" allows you to load a new Life pattern from disk.
The Life file names end with ".life" (no quotes).
IF YOU HAVE ARP:
If you have arp.library (ARP 39+, REL1.3) in your LIBS: directory you
will get the Heath File Requester. You will be shown only files that
end in ".life" (upper or lower case does not matter). Double click on
a file name to load it.
IF YOU DO NOT HAVE ARP:
If you do not have arp.library you will see a requester with a string
gadget into which you may type a file name to load. Be sure you give a
path name if the ".life" files are not in the current directory.
You may include ".life" when you type in the file name or you may leave
it out. However, on disk the file name must include ".life".
There are three file types: Absolute, Relative and Picture (denoted in
the files with "#A", "#R" or "#P"). An Absolute file will immediately
be displayed on the screen. The other file types will wait for you to
click on the screen to indicate where to display the pattern from the
file. The mouse pointer will change to a picture of a glider life form
to indicate FastLife is waiting for a click.
FastLife will indicate if part of the Life pattern falls off of the
screen's edge.
NOTE - the "*.life" files are separated into directories by screen
size. Within the 320 by 200 directory the files are in sub-directories
solely so floppy disk users won't have to wait for the Heath requester
to load 130 filenames each time they want to Open a file.
Project-33mOpen Again0m - You may load the previous file again by selecting
"Open Again". If the file is Relative or Pattern you must again click
to show where to load the pattern on the screen. (You may want to
select "New" before using "Open Again". The file name is not lost when
"New" is selected.)
Project-33mAbout0m - Shows the current version number and date, along with
credits to the authors.
Project-33mScreenToBack0m - Sends the FastLife screen to the back (behind
the Workbench screen).
Project-33mGeneration0m - The Show subitem will show the current generation
number. The "Reset" subitem will reset the generation number to zero.
Porject-33mScreenSize0m - Selecting a subitem under screen size will change
to that size. NOTE: The current Life pattern on the screen will be
lost when a new screen size is selected.
Project-33mPriority0m - select Lower (-1), Normal (0), or Higher (1) task
Priority
The Lower, Normal and Higher subitems set the task priority of FastLife
to -1, 0 or +1 respectively.
Caveat: Task priorities on the Amiga range from -127 to +127. It
might appear that increasing or decreasing Fastlife's priority by only
one would have little effect. This is not true since the priority
number only establishes an 3morder0m. The difference between the
priorities matters not. If you select a Higher priority for FastLife
it can prevent any program at a lower priority (such as zero) from
running at all. Since most programs run at priority zero, FastLife
with Higher Priority (1) can stall them completely. Conversely, if
FastLife's priority is Lower (-1) other programs can stop FastLife from
responding. A complication to all this is the interaction of programs
when they are waiting. A program with higher priority can allow lower
priority programs to run if it has nothing to do at the moment (as when
a word processor is waiting for you to type something). Polite programs
yield to lower priority programs as much as possible. If FastLife is
running at its fastest (i.e., number key '1' selected) it will never
yield to lower priority programs, thus stalling them completely. If
you select a number key '2' through '9' FastLife will be waiting part
of the time and will yield to other programs. If you select a Lower
priority for FastLife and a higher priority program does no waiting (as
when you "TYPE" a file in a CLI or Shell) FastLife will not respond to
your commands. The cure for this is to cause the other program to wait
(Stop the mandelbrot generator, or send Break to the CLI or Shell,
etc.).
Project-33mQuit0m - closes FastLife
CalcMode-33mBlitter0m - Use the Blitter for calculating
CalcMode-33mCPU0m - Use the 680x0 CPU for calculating
Control-33mOnce0m - Calculate one generation
Control-33mSpeed0m - describes how to control the speed of FastLife
Selecting the Speed menu item will display a brief description of how
to slow FastLife. Slowing FastLife will allow you to see what is
happening in more detail.
Pressing one of the number keys '1' thru '9' will select fastest
through slowest, respectively. '1' introduces no delay. Each higher
numbered key slows FastLife more. '9' introduces about ten seconds of
delay between each generation. (Also see the caveat under "Priority.")
Control-33mRun0m - causes the screen to update continuously
Control-33mStop0m - stops updating of the screen.
-----
Selecting "Once" or "Run" will appear to do nothing if there is no Life
pattern on the screen. Open a pattern file first. Also note that
selecting speed key '9' may make it appear FastLife is stalled when it is
not.
You may make multiple menu selections at one time, for example: Press and
hold the right mouse button, point at "Project-New" and click the left
mouse button; point at "Project-Open" and click the left mouse button.
Release the right mouse button. This will clear the screen and bring up
"Open" in one menu action. Multiple menu selections are explained in your
Amiga software manual.
1m32m
F i l e F o r m a t
0m
The Life patterns supplied with FastLife are stored in files that end in
".life" (The Heath File Requester will display only file names that end
thusly). The patterns were obtained with "xlife" for X-Windows under UNIX
and retain a subset of the formats used there.
You can make your own Life patterns using your favorite text editor, just
be sure to follow the format described below. Also be sure that your file
name ends in ".life" so the Heath File Requester will show it.
Multitasking on the Amiga will allow you to switch back and forth between
FastLife and your editor to speed your work.
Picture file format - The "Picture" file format has a "#P" as the first
line. Each line that follows represents a line of cells across the screen,
with "*" being an ON cell and any other character being an OFF cell.
An example of a Picture file is
#P
**.
.**
.*.
Absolute file format - The "Absolute" file format consists of pairs of
absolute X-Y addresses of the cells to turn ON, one pair per line. The
file may or may not have "#A" as the first line.
Relative file format - The first line of a "Relative" file must contain
"#R". Each following line is interpreted as a relative X-Y address
(relative to the position on the screen where you click) of a cell to turn
ON. The upper left of the image will normally be placed where you click
the mouse on the screen. Two integers may be placed on the first line
following the "#R" to offset the image.
1m32m
W h i c h i s F a s t e r ?
0m
Alternately pressing Right-Amiga-C and Right-Amiga-B will switch between
CPU and Blitter calculating mode. If it is not obvious which is faster,
use the following procedure -
1. Open 3many0m life pattern
2. Select menu item CalcMode-33mBlitter0m
3. Select menu subitem Project-Generation-33mReset0m
4. Run Fastlife for 10 seconds by your watch
5. Select menu item Control-33mStop0m
6. Select menu subitem Project-Generation-33mShow0m & divide the count by 10
7. The result is generations per second for 4mBlitter0m mode
8. Select menu item CalcMode-33mCPU0m
9. Select menu subitem Project-Generation-33mReset0m
10. Run Fastlife for 10 seconds by your watch
11. Select menu item Control-33mStop0m
12. Select menu subitem Project-Generation-33mShow0m & divide the count by 10
13. The result is generations per second for 4mCPU0m mode
14. Compare the results in step 7 and 13.
1m32m
I n t e r e s t i n g P a t t e r n s
0m
Alu.life
bunnies.life
f2.life
glider1_2.life
glider2_2.life
gliderglidergun.life
oscillators.life
p24.life
p26.life
p55.life
rabbit.life
randomgun.life
round.life
switchengine.life
1m32m
I f Y o u H a v e T r o u b l e
0m
Be sure you have a pattern on the screen before you RUN or it will appear
that nothing is happening.
Close screens, windows, projects and tools (or reboot) to free CHIP and
FAST memory if you can't get the screen size you want or blitter support.
Reboot to remove memory fragmentation.
You will want arp.library in your LIBS: directory (it's not a requirement
but will make your FastLife much easier). Arp.library is available on many
bulletin boards and "public domain" disk collections.
-----
FastLife was developed with Manx Aztec C version 5.0e and has been tested
with Workbench 1.3 and 2.04. Its executable size is less than 30
kilobytes.
1m32m
A u t h o r
0m
FastLife
By
Ron Charlton
9002 Balcor Circle
Knoxville, TN 37923
(615)694-0800 evenings Eastern Time
Internet: charltr@ornl.gov
1m32mH i s t o r y0m
4mVersion 1.00m
Initial Release
4mVersion 1.10m
The VERSION Shell command is supported.
The flags passed to the ARP file requester were corrected.
The Tools menu was changed to CalcMode menu.
Anything following FastLife's name on the command line forces CPU
calculation mode.
FastLife's version is shown in its Workbench window.
SaveAs and Save menu items were removed.
When opening a Relative or Picture format file the mouse pointer
changes to indicate a mouse click is needed to position the lifeform.
Speed control with the number keys was added.
The Pause menu item was changed to Stop.
Various menu shortcut keys were added.
A Control-Speed menu item was added to explain how to control the
speed of FastLife.
A Project-Priority menu item was added to select a task priority of
higher (1), Normal (0) or Lower (-1).
The Icon Tooltypes CALCMODE=BLITTER and CALCMODE=CPU were added.
Clicking on FastLife's Workbench window brings the FastLife screen to
front.
FastLife adapts to "any" Screen and Default text height and width.
"FASTLIFE" now appears on the startup screen.
The 'B' and 'C' keys select blitter and CPU, respectively.
Menu checkmarks and ghosting were added where appropriate.
".life" is added to file names if not supplied.
And last but not least, there was a code cleanup.
3mEnd FastLife.doc0m