home *** CD-ROM | disk | FTP | other *** search
- LIFE, an interactive version, 15.0 generations per second.
- by Dave Storer,
- with unknowing contributions from
- Tomas Rokicki and Charlie Heath.
-
- This version of the LIFE program is placed in the public domain and may
- be freely distributed, in the hopes that someone else will build on this
- the way I have built on the work of Tomas Rokicki and Charlie Heath.
-
- LIFE is a form of cellular automaton invented (discovered?) by the mathe-
- matition John Horton Conway. The life universe is a rectangular array of
- cells. Each cell is either alive (white) or dead (blue), and has eight
- neighboring cells. What happens to a cell in the next generation depends
- on the number of its living neighbors. Zero, one, or four through eight
- living neighbors cause a cell to become or remain dead. Two living neighbors
- cause the cell to remain in the same state, living or dead, as in the
- previous generation. Three living neighbors cause the cell to become or
- remain living in the next generation. These simple rules generate
- complex interactions which are wonderful to watch at high speed.
-
- This version owes its speed to Tomas Rokicki, who wrote the original blitter
- program which I found on Amicusdisk 31 (also Fred Fish disk 31). I've added
- interactive capability, as an exercise in learning C and the Amiga internals.
- This version does NOT run at 19.8 generations per second, because of the
- extra stuff in the main loop. With Depth 1, it runs at 15.0 generations per
- second. For depth 3, it runs at about 13.5 g/s, quick enough for most of us.
- This version does not "wrap-around" as some other LIFE programs do. The
- active display area is 318 cells by 188 cells.
-
- Rokicki's original doc files, POSTER, WARNING, and WARNING2 are included,
- as the blit.c file has not changed.
-
- The file requestor is a slightly modified version of the GetFile example
- by 'cheath' in the Manx C (3.4a) SYS3:Examples directory. I have included
- the object files only.
-
- Controls.
-
- This version of LIFE is controlled by the mouse, the keypad keys, the
- control keys on the regular keyboard, and the letters and special char-
- acter keys.
-
- ESCape. This key terminates the program.
-
- Left-Amiga-n. This switches to the LIFE HELP display.
-
- Left-Amiga-m. This switches back to the LIFE display.
-
- Letter, number, and special character keys. These may be assigned to any
- pattern of cells from 1x1 up to 16x16. These assignments are
- specified in the file, LIFE.KEY. By pressing one of the
- assigned keys, (unassigned keys flash) the cursor changes to
- the shape from the LIFE.KEY file. The key assignments and
- the accompanying text strings are displayed on the HELP screen.
-
- Left mouse button. This is used to place the cursor shape on the display.
- At the left and bottom edges, you may not get a complete copy,
- as the cursor shape is clipped to fit on the screen. You may
- place a shape onto a running display. Gliders placed this way
- give interesting effects.
-
- Right mouse button. Clicking this rotates the cursor shape 90 degrees. If
- the shape has four-fold symmetry, you won't see anything happen.
-
- Either-Amiga-left-alt. Same as left mouse button.
- Either-Amiga-right-alt. Same as right mouse button.
- Either-Amiga-arrow-key. Useful for moving the cursor very precisely. These
- three combinations are good for setting up complex displays
- where the positioning of adjacent shapes is critical.
-
- Return and Tab. These keys cause the cursor shape to change to its mirror
- image shape. If the shape has two-fold symmetry, you have a
- 50-50 chance that the shape will change.
-
- Spacebar. Toggles between RUN and STOP state. When in the STOP state,
- the title bar shows the generation number. By holding down
- the spacebar, you can run LIFE at one-half the repeat rate
- of the keyboard. This can be altered from Preferences.
-
- Backspace. Causes the display to advance to the next generation and then
- stop. It does this from either the RUN or the STOP state.
- Holding the backspace down to rapidly single step the display
- is probably better than using the spacebar, as you will always
- be stopped when you release the backspace.
-
- DEL. This key causes the display to back up one generation. However,
- see keypad controls '1', '2', and '3'. Normally only useful
- when stopped.
-
- Keypad controls.
- Kp Enter. This key brings up a file requestor. You can read predefined
- patterns into the display. All of the patterns provided end
- with the .pat suffix. Reading also makes a copy in the quick
- restore buffer (see Kp '7' and Kp '9') and sets the generation
- number to zero. By selecting the WRITE gadget, you may save
- interesting patterns to disk. (Mnemonic: Enter a pattern
- into the display from disk.)
- Note that if you specify a directory (drawer) on a disk,
- you must end with '/', as the drawer name and file name are
- concatenated to form the full name. E. g. 'df1:life/' for
- the drawer and 'box.pat' for the file name.
-
- Kp '-'. Toggle erase mode. In erase mode, the cursor will erase any
- live cells under it. The eraser is actually the size of the
- smallest rectangle containing the cursor shape. (Mnemonic:
- You are subtracting something from the display.)
-
- Kp '.'. This places the display into tile mode. In tile mode, whichever
- cursor you have selected is used to fill the entire display.
- This can yield some interesting effects. In the file LIFE.KEY,
- some of the colony names start with * and end in "farm." These
- shapes have enough extra space around them so that in tile mode,
- they are not too cramped to be interesting. (Mnemonic: The
- display is filled with a PERIODic ((ouch)) pattern.)
-
- Kp '0'. This key causes the display to be cleared. To prevent acci-
- dental erasure, you must hold down the right shift key at the
- same time. Generation number is set to zero. The quick restore
- buffer is NOT cleared. (Mnemonic: Clearing a calculator puts
- Zero on the display.)
-
- Kp '1', '2', '3'. This is the depth of the screen display. This controls
- how many previous generations are saved. When Kp '1' is
- pressed, one bitplane is used, and no previous generations are
- saved. In this case the DEL key has no effect, and LIFE
- runs at its maximum speed. When Kp '2' or '3' is pressed,
- you may back up at most one or two generations, respectively,
- and the display runs a little slower.
-
- Kp '4'. Restore the backgound grid. Unfortunately, placing a colony
- on the display by clicking the left mouse button erases the
- grid under the cursor. I can't find a simple way to avoid
- this, hence the requirement for the Kp '4'. (Mnemonic: the
- '4' has a cross in the middle like the ticks on some grids.)
-
- Kp '5'. Remove the background grid.
-
- Kp '6'. Generate a random display of live cells. Set generation
- number to zero, and save the random display in the quick
- restore buffer. (Mnemonic: A six sided die is often used as a
- randomizing tool.)
-
- Kp '7'. This restores the display from the quick restore buffer. It
- may be used both while running and stopped. The generation
- number is reset to zero.
-
- Kp '9'. Saves the current display to the quick restore buffer. It may
- be used both while running and stopped. (Mnemonic: "A stitch
- in time saves nine.")
-
-
- Key assignments from file 'LIFE.KEY'.
- The names I have chosen are probably not the names in common use among
- those who have studied LIFE in depth.
-
- '0'=Blob Stable.
- '1'=*Small glider farm
- '4'=Block Stable.
- '7'=7 gliders Simple pattern which explodes and throws off
- seven gliders before becoming a still-life.
- '8'=Big flipper Generates a large three-cycle oscillator.
- '#'=Line+dashes3 A series of these, end to end leaves behind an
- array of blocks.
- '^'=Hat A building block. Upshift of '6' key.
- '-'=Small flipper Simplest two-cycle oscillator.
- '+'=Four cells Like block but rotated 45 degrees.
- '='=Line+dashes2 Like # but leaves nothing behind.
- '|'=15 step oscillator Longest period oscillator I've found.
- 'b'=Brick Stable.
- '^B'=*Big Bang ^B means press CTRL key and B key together.
- In tile mode, generates a stable densely packed
- array of blocks, which is stable. A single dot
- added will either do little or will cause a major
- catastrophy.
- 'c'=Little c Not stable by itself. Back to back with itself,
- with one or two spaces between, yields a stable
- pattern or a two-cycle oscillator.
- 'C'=Big C Can be used to build stable patterns, like 'c'.
- 'D'=Big D Stable pattern. Can be packed with itself on a
- diagonal and still be stable.
- 'f'=Edge Galumpfer In the center of the screen this is not stable.
- Along an edge, or back-to-back with itself,
- it forms a peculiar 14-cycle oscillator.
- '^F'=*Flipper farm For tiling the screen with small flippers. See
- Big Bang.
- 'g'=Small glider This pattern moves along a diagonal.
- 'G'=Big glider This pattern moves horizontally or vertically.
- '^G'=*Glider farm Useful for tile pattern of Big Gliders.
- 'i'=Little I-beam Interesting small explosion.
- 'I'=Big I-beam Ditto. Both I-beams are good for building
- interesting larger patterns.
- 'L'=Corner Useful building block. Changes to block in one
- generation if by itself.
- 'o'=Little o Stable.
- 'O'=Big O Not stable.
- '^O'=*O'Farm Interesting failure.
- 's'=S septomino Stable. Good building block. Will "eat"
- small gliders if everything is just right.
- 'r'=R pentomino Small, 5-cell pattern which explodes grandly.
- '^Z'=*Diag line farm Long diagonal lines are interesting when some
- small colony is tacked on at an end.
- '.'=Single dot Use this for building things. Especially useful
- in erase mode for fixing goofs.
- '/'=3-dot diagonal line Building block.
-
- Notes on LIFE.KEY file.
- The LIFE.KEY file is an ASCII file and can be modified as you like,
- provided the format is correct.
-
-
- Some words of warning about the format of the LIFE.KEY file. This file
- defines all of the cursor forms and their key assignments. You may have up
- to 100 colony forms in this file. The format must match the examples
- already in the file.
-
- Each colony has the format:
- <name>#
- k w h definitionarray
- where name may be up to 18 characters long and must end with #.
- The key assignment is given by k, which may be upper or lower case, or a
- ctrl-key, if your editor can do that. The width (w) and the height (h) of
- the definition array come next, followed by a series of space-separated
- zeros and ones to define the colony pattern. Ones are living cells,
- zeros are dead cells. Maximum value for w and h is 16.
-
-
- Notes on some '.pat' files.
- hline.pat A horizontal line. This gives an interesting recursive
- explosion.
- hline1.pat Like hline.pat, but with live-live-dead-dead pattern repeated
- along one side. Does not behave at all like hline.pat.
- hline2.pat Like hline1.pat, but the added pattern is two live and three
- dead cells adjacent to the line. Try it to see what happens.
- vline.pat Single vertical line.
- box.pat A large rectangle of single lines.
- box1.pat Like box, but with two diagonals added.
- Start.pat A little of everything in this one. The lower left corner is
- the thing to watch. A 14-cycle edge galumpfer and a 15-cycle
- oscillator eventually reach a phase relationship where they
- interfer with each other and trigger the "fuse" which
- ultimately destroys almost everything. Finally settles down
- at about generation 2500.
-
- Enjoy. I think this beats 100,000 dominoes any day.
-
- Dave Storer
- 2916 Mansfield Ave. SE
- Cedar Rapids, IA 52403
-
- Compuserve 71420,2672
-
- P.S. Things which this program needs to improve.
- 1. A lens system. After an hour of building patterns, you get retina
- raster burn.
- 2. A glider gun pattern. I know these exist, but I haven't had time
- time find one.
-