life.c
freely distributed

the file map.c reads palette files with 256 lines of color
values, 3 to a line and puts it in the format the life.exe
program can read.  There is an example map called volcano.map taken
from the fractint distribution.  The resultant map file must be named
palette.lmp for life.exe to use it. map.c is not needed to compile life.c.
there is also some palette changing junk at the end of life.c that I never
got around to putting in.


the .pat files can be loaded and saved from within life.  a glider
is included here as an example.

----------------------------
Modifications by Terry Newton (original code in origlife.zip):

Added Aug 24, 1995 - Found this code on my hard drive, perfect chance to
test my new C compiler. What a great program! But thought I'd add some
new features...

- Added a random mode that engages a new starting pattern whenever the
  current one ceases to reproduce so it's always changing. This was pretty
  easy to do, despite having close to zero understanding of the underlying
  data structures. I just copied code from other sections and threw some
  in of my own.

- Added the ability to load LIF files as included in LIFE16 and other
  life programs. No rule changes though, so if it's not for normal life
  rules you won't see much. Only #P and @ are recognized. When loading
  in text LIF files it clears the cell grid before loading. Native files
  saved by this program do not clear the grid when loaded, allowing
  patterns to be stacked one on top of another.

- Since I have to remember enough as it is, I added a directory scan
  feature. Press the /? key when it asks for a filename to show all LIF
  files one by one. Return selects it, Esc quits, any other key gets the
  next file name. Press P and L to switch the masks from *.LIF to *.PAT.

- Added a delay feature to slow it down to see what's going on. Press the
  D key for five levels of delay between generations. No feedback is
  given when not generating but it still registers. Speed selected will
  remain in effect until changed.


About the load routine...

The file load routine now handles most text-format LIF files, all except
the coordinate list type. All # commands except #P are ignored. Absolute
coordinates may be specified by @ X Y, #P X Y coordinates are specified
relative to the centerpoint. #P and @ commands must not contain extra
spaces! My crummy parser can't handle it. So far it appears to load all
of the files I have that use '*' for cells, plenty of files to use without
worrying about coordinate lists, the other popular format. I'd add that
too but it seems some lists are absolute and some relative with no easy
way besides guessing to tell apart.

Remember, all saved files will be converted to native format, so save to
NAME.PAT instead of NAME.LIF to avoid overwriting the text versions.

------
April 27, 1996...
- Z turns color cycling on and off - initially on.
- Y turns PrettyColors on and off - initially off.
- Added feedback for Z (colors) and D (delay).
- Fixed load prompts to make more obvious what to do,
  touched up screen display and other minor stuff.

------
December 29, 1997...

No code changes but this is a neat program, lots would enjoy it
and should be available to all. Included files...

ORIGLIFE.ZIP - zip of the original program as I found it
LIFE.EXE     - the main LIFE executable
MAP.EXE      - a program for converting palette maps for LIFE
SETMAP.BAT   - run with name of color map to use (calls MAP.EXE)
VOLCANO.MAP  - color map
FIRESTRM.MAP - another color map
PALETTE.LMP  - the LIFE program's color file
*.C, *.H     - source code files
*.ICO, *.PIF - windows stuff (95-type pifs)
*.LIF, *.PAT - a few sample patterns

I was unable to find the author Paul Jeffris, so hope he
approves of my hacks... the note said "freely distributed"
so I assume it's cool. Neat code, dude!

Under Windows 95, double-clicking SETMAP brings up a dialog box,
enter the name of the map file, VOLCANO or FIRESTRM for example.
Assumes .MAP if no .ext specified. Under Windows 3.1, delete the
PIFs and use PifEdit to make new ones. Put a ? in the optional
parameters box SETMAP.PIF so it will ask for the map name.

Note on color maps - if using standard maps (like from Fractint)
you should modify the first few entries of the color map (9?) to
specify the program colors. Not sure what does what, I've been
just cutting and pasting and going with it, if I really want to
see the pattern I turn the color off anyway.

Only a few *.LIF patterns are included, for tons check out
Al Hensel's site at http://www.mindspring.com/~alanh/life/

12-30-97... ok, cleaned up the position parsing so #P by itself
doesn't crash it. Modified *.h so program colors come from 0-8.

--------
Terry Newton
email: wtnewton@nc5.infi.net
wwweb: http://www.nc5.infi.net/~wtnewton/otherwld/
