LIFE-ETC.BAS July 1997 by Marc Kummel aka Treebeard. Contact mkummel@rain.org, http://www.rain.org/~mkummel/ About LIFE-ETC: ----------------- LIFE-ETC is an old program from the Vault (1989) that runs a dozen-plus different cellular automata, including the classic Life, all with a shared interface. It's slick, but slow, probably as fast as can be in Basic. My program has a slick editor and many other goodies, and it's very easy to use. I used an earlier version of this program as a challenge/stumper for the kids in my science class at Dunn Middle School, to discover the pattern. It's a good way to practice "scientific method", though only a few kids really rise to the challenge. Slow and small is probably better for that purpose. The original Basic code for this program dates back to 1989 and before, but I made some major changes for this release, mostly in the menus and editors. I had an ulterior motive in doing this. I have *lots* of old programs written for my original XT clone with a Hercules monochrome display that I want to convert to VGA so I can use them at school. So I fussed with menus in this just to remember how my old NPF frame routines work. They're not bad! I really prefer this interface to Windows, though it's sometimes a pain to combine mouse and menu action. Check out the Cell editor and the Turing Turtle editors. The next old program I convert will be much easier. *Sigh* Then again, it might be easier just to convert to Visual Basic! It uses Basic integer arrays to store cell values, but this is *really* wasteful since it uses a 2 byte integer to hold just a few bits of data. But adding Basic code to use memory better would slow it down even more. Ditto with strings probably. This is also why a size 1 cell is really 2 pixels square. Any smaller hits the Basic 32K size limit for arrays. Speed isn't everything. (Hah!) To do it right, LIFE should be programmed in assembler. I'd consider it, but it's already been done better than I could hope. LIFE v106 by Al Hensel is an infinitely better LIFE program that exemplifies the hacker ethic in the original sense. You can find it on his homepage at http://users.vnet.net/alanh/life/ Get it! It works a universe of 500k x 500k cells, and it's so fast on my ancient 486 that I have to slow it down. If I'd had this program 10 years ago, I probably never would have written this. But that's sometimes the problem with great programs, we don't even try! My program can share data files, and there are some extraordinary ones. I've swiped a couple of simple "classic" patterns for this distribution, but you really should get the full set, available on the Net as LIFEP.ZIP. Some of these patterns too big (and slow) for my program. If world wrap is ON or CYCLIC, then my program uses the cells around the screen to store the other side of the screen. If you switch to a higher-res screen, you will notice the frame. Switch wrap OFF first. About Cellular Automata: -------------------------- Cellular Automata (CAs) are simulations that occur in a universe of cells. Cells have different internal states, represented as numbers and shown on the screen as different colors. Cells change states according to fixed rules and evolve through a series of successive generations that we see as changing color patterns. Different CAs follow different rules and evolve differently, but they have several characteristics in common: * They work in parallel. Each cell figures it's new state at the ---------------------- same time. All cells change (or don't) at the same time. * They are homogeneous. Each cell follows the same rules for --------------------- changing states. There are no privileged cells or special places. * They have no memory. Each cell only considers its present -------------------- situation when deciding how to change state. * They are local. Each cell only considers its own state and --------------- its closest neighbors when deciding how to change state. Because of these constraints, CAs are intrinsically simple, even if the actual rules they implement are not. There's nothing hidden. What's remarkable is that simple rules can generate complex behavior that is surprising and unpredictable. Even more remarkable, the right rules can generate Order from Chaos. CAs should be like a Chameleon on a mirror, each cell endlessly changing to reflect its neighbors as they try to do the same thing, in an endless loop. Yet order and pattern often emerge, and the same patterns often emerge even with totally different rules. There's something universal here. CAs, fractals, and other systems that exhibit complex dynamics provide a working model for "emergent properties" that is relevant to philosophical discussion. They drive a wedge between being determined and being predictable. They may model the real universe. The Automata: --------------- LIFE-ETC currently runs 14 different types of Cellular Automata. Several let you modify the rules, so there are literally millions of CAs to play with! Here are the basic types. Classic Life ------------ Stochastic Wildfire ------------------- Diffusion-Limited Aggregation ----------------------------- Fredkin Automaton ----------------- Ulam Reef --------- Life With Rules (1) ------------------- Life With Rules (2) ------------------- Universal 2-D Automaton ----------------------- Universal 1-D Automaton ----------------------- Gerhardt-Shuster Infection -------------------------- Griffeath Crystals ------------------ Bly Automaton ------------- Turing Turtle ------------- Diffusion --------- Running LIFE-ETC: ------------------- File List: ------------ The files shown below the dotted line are source files that can be deleted if you don't need then, but I won't do it for you. LIFE-ETC.EXE DOS executable LIFE-ETC.PIF run in Win31, full screen only LIFE-ETC.ICO an icon for Win31 VGAOEM.FON Win31 font in case it's not on your system ACORN.LIF sample Life patterns swiped from the LIFEP archive BHEPTO.LIF BI-GUN.LIF GUN.LIF PUFTRAIN.LIF README.TXT this file TBVAULT.TXT about Treebeard's Basic Vault ------------ LIFE07.MAK file list for PDS/QB LIFE07.BAS source code: main module LIFEMOD1.BAS source code: some overflow XQB.BAT batch file to start PDS with source code MAKE.BAT batch file to compile and link from DOS prompt LIFE-ETC was written for MS Basic PDS 7.10. QB4.5 will probably need some changes. It won't work with QBasic. To use the source code, you will also need the following files from my NPF program archive, also available from Treebeard's Basic Vault at http://www.rain.org/~mkummel/basic. Copy the files to your LIFE-ETC directory. The code requires special library routines and EMS sharing so start PDS with /L TBLIB and /ES options, or use the XQB.BAT batch file. The required files are: NPSUP.BI include file of global declarations and variables GFONT5.BAS code module to use Windows *.FON fonts EMS4.BAS code module to use expanded memory SBSUP16.BAS code module of support routines TBLIB.QLB Quick Library of misc assembler routines TBLIB.LIB Library files for compiling Original Sources: -------------------- These are (mostly) the sources I used for the original 1989 version of this program. William Poundstone, _The Recursive Universe_, Contemporary Books, 1985. (Life, Ulam, Fredkin) Byte, Dec 1978, p.54. (Life) Ivars Peterson, Science News, 3 Oct 1987, p.220. (Wildfire) A.K. Dewdney, "Computer Recreations" in Scientific American, much missed regular column. A few I remember are: SciAm, Aug 1988, p.104. (Infection) SciAm, Sep 1989, p.180. (Turing Turtles) SciAm, Aug 1989, p.102. (Crystals) SciAm, May 1989, p.141. (Diffusion-Limited Aggregation) These are collected in his books published by Freeman: _The Armchair Universe_, 1988. _The Magic Machine_, 1990. _The Tinkertoy Computer_, 1993. _The New Turing Omnibus_, 1993. (Byl - but it doesn't work!) Martin Gardner, "Mathematical Games" in Scientific American, also much missed. Gardner introduced Life (and much else) to the world. His classic Life columns from 1971 are reprinted in: _Wheels, Life, and Other Mathematical Amusements_, Freeman, 1983. John Conway created Life. His analysis is in chapter 25 of volume 2: Berlekamp, Conway, and Guy, _Winning Ways_, Academic Press, 1982. Piers Anthony, _Ox_, Avon, 1976. Sci-fi book that uses Life, sort of. Rudy Rucker, original cyberpunk, sci-fi, math, software, lots of interesting stuff. I found him after I started this. Some out of print software and the CA Lab manual are available on his homepage. His sci-fi trilogy Software, etc. addresses the question of self-reproducing automata. Rucker is the author of *many* books. These are especially relevant: _Mind Tools_, Houghton Mifflin, 1987. Math expo. _CA Lab_, Autodesk, 1989 Book and software. _Artificial Life Lab_, Waite Group, 1993. Book and software. _Chaos: The Software_, Autodesk, 1991. Book and software. _Software_, _Wetware_, _Freeware_, Avon, 1987-1997. Sci-fi. Some Web Sources: ------------------- Here are a few Web links for Life and other cellular automata. Follow links and search the usual places for much more. Rudy Rucker Homepage, much software to download, including CellLab, Boppers, calife (1D automata), and his new CA program CAPOW! (Win95/NT only). Good stuff! http://www.mathcs.sjsu.edu/faculty/rucker/ The Primordial Kitchen Sink, lots of CA links and software from one of the creators. http://math.wisc.edu/~griffeat/kitchen.html Paul's Page of Conway's Life Miscellany, lots of *.lif patterns with interesting commentary. http://www.cs.jhu.edu/~callahan/lifepage.html Brian Eno talk on Life and Music, finding complexity and surprise in simple rules. http://www.inmotionmagazine.com/eno1.html Al Hensel's lightning-fast MS/DOS implementation of Life. Get this program! http://users.vnet.net/alanh/life/ ftp://ftp.cs.jhu.edu/pub/callahan/conways_life/life16.zip And the definitive Life pattern collection (compatible with LIFE-ETC). ftp://ftp.cs.jhu.edu/pub/callahan/conways_life/lifep.zip ftp://alife.santafe.edu/pub/topics/cas/software/ Artificial life homepage in Sante Fe. http://alife.santafe.edu/ Web Life, small and slow. There are others. http://www.research.digital.com/nsl/projects/life/life.html Usenet (not very active) comp.theory.cell-automata comp.ai.alife Conditions: ------------- This program and source code are yours to use and modify as you will, but they are offered as freeware with no warranty whatsoever. Give me credit, but do not distribute any changes under my name, or attribute such changes to me in any way. You're on your own! Send comments and fixes to: Marc Kummel aka Treebeard mkummel@rain.org http://www.rain.org/~mkummel/ For more interesting Basic software with source code, check out Treebeard's Basic Vault at http://www.rain.org/~mkummel/basic/