The Game of Life 1 What is Life? "Life" is a form of cellular automaton. It consists of a grid of spaces on which individual cells live or die according to certain rules. Although the rules appear quite simple, the results of following them can be fascinatingly complex. "Life" was invented by John Horton Conway, a mathematician at the University of Cambridge. It was popularized by Martin Gardner who wrote a number of columns about it in Scientific American. Gardner also describes it in considerable detail in his book "Wheels, Life, and Other Mathematical Amusements" (W. H. Freeman & Co., 1983). 2 How does "Life" work? Start with a large rectangular grid and put markers on some of the squares, either at random or according to some predefined pattern. The occupied squares (or "cells") are said to be "live". The empty cells are "dead". Then at each tick of the clock set the states of all the cells according to the following rules: If a cell has exactly two living neighbors (left, right, up, down, or diagonal), its state remains unchanged. If a cell has exactly three living neighbors, it will become or remain live. A cell with any other number of living neighbors becomes or remains empty or dead. These changes are synchronous, with all cells that change state changing simultaneously. The cycle might be implemented as follows: Observe the states of all the cells. Count up each cell's living neighbors. Mark those living cells doomed to die. These are still alive for purposes of determining the fates of their neighbors. Mark those empty squares where cells are about to be born. These are still empty for purposes of determining the fates of their neighbors. Once all fates have been determined, add or remove markers in accordance with the new state of affairs. Repeat the cycle. Gardner describes a procedure for doing this with checker pieces of different colors. Nowadays it is generally done with a computer. 3 What are some simple patterns to experiment with? Here are three, with the asterisks representing live cells. In each case there should be nothing else nearby, and the pattern should not be too near an edge. ........ ..... ..... .....*.. ..*.. ..*.. ......*. ..*.. ...*. .*....*. ..*.. .***. ..*****. ..... ..... ........ Blinker Glider Spaceship The "blinker" consists of three live cells in a vertical or horizontal row. It oscillates back and forth between vertical and horizontal. The "glider" crawls across the board diagonally at the rate of one square every four moves. It changes shape as it goes, returning to its original shape and orientation (but not its original position) every fourth move. When it completes a four-move cycle it is one square diagonally away from where it started. As shown it will move down and to the right. You can make it move a different direction by rotating it 90 or 180 degrees. The third figure is the "spaceship". It moves horizontally to the right at the rate of one square every two moves. You can of course make it move some other direction by rotating it. 4 How do I use the computer program? This program runs under Windows 3.1 (or later) on PC-type machines. If your machine can run Windows, it can probably run this program. It may run slowly on some machines, but it should still run. The only requirement over and above standard Windows is a mouse. 4.1 Installation These instructions assume you know how to handle directories and files under Windows. For information on how to copy, move, and rename files please see your Windows manuals and online help. The program may come as either a ZIP file or a self-extracting EXE file, depending on where you got it. Create a new directory, move (or copy) the file into it, and unzip it. The ZIP file requires the program PKUNZIP to unzip. The EXE file will unzip itself when you run it. This will produce the following files: README.TXT This document LIFE.EXE The main program LIFE.ICO An icon LIFE.INI User settings You can run the program from Program Manager by typing its name and path (such as C:\MISC\LIFE\LIFE.EXE). You can also click on it in File Manager to run it. If you want a more permanent installation you can use the File menu in Program Manager to add Life to a program group. See your Windows manuals for details. This program does not modify WIN.INI or CONFIG.SYS or AUTOEXEC.BAT. It keeps all its settings in LIFE.INI. 4.2 Operation These instructions assume you know how standard Windows controls such as radio buttons and check boxes work. Please see your Windows manuals or Windows online help for details of those items. When the program starts you will see an empty playing field (with or without grid lines) and a message box telling you to click on a cell to change its state. Hit Enter or click OK to clear the box, then click on any cells you wish to make "live" for your initial experiments. You might wish to try the simple patterns described earlier. Or maybe just hold down the left button and scribble randomly with the mouse and see what happens. You have a good chance of finding something interesting that way. Even though the field is relatively small (40 wide by 30 high) it is enough for many interesting patterns. 4.2.1 Menus and Controls At the top of the screen will be a menu bar with the normal Windows icons for Maximize, Minimize, and Close. There are also a number of menu items: File: This brings a pulldown menu with the following items: File/About: Shows copyright and version information. File/Preferences: Brings up a dialog box with the following items: File/Preferences/Show Grid Lines (check box): When checked, grid lines show to define the cells. When unchecked, there are no grid lines. Any change to this setting takes effect on the next running cycle, or when the Clear function is activated. File/Preferences/Dead Cells Leave Fossils (check box): When checked, empty squares that once contained live cells are a different color from empty squares that have always been empty. This allows such things as having gliders and spaceships leave trails. When unchecked, all empty squares are the same color, regardless of whether or not they once contained live cells. Any change to this setting takes effect on the next running cycle, or when the Clear function is activated. For purposes of this function, history starts over when cells are cleared or when the setting is turned off and back on. File/Preferences/Save Settings on Exit (check box): If checked, the checkbox settings described above, as well as the Speed and Topology settings (see below) and the window size, are saved in LIFE.INI when the program exits. If unchecked, LIFE.INI is not modified. NOTE: If you uncheck this box and want that fact saved, you must use the Save Settings function below. File/Preferences/OK and Cancel buttons: OK causes the settings to take effect. Cancel leaves all as before. File/Save Settings: Immediately saves the Preferences settings, as well as the Speed and Topology settings (see below) and the window size, regardless of the state of the Save Settings check box. You can use this to save the fact that you don't want settings saved automatically on exit from the program. File/Exit: Terminates the program. Run: Starts the clock. Cells are born and die at intervals determined by the Speed setting (below). Clicking on a cell will change its state even though there is no message reminding us of that. Hold: Stops the clock so patterns may be studied or modified. A message box reminds us to click on a cell to change its state. Clear: Clears the playing field. A confirmation box allows a chance to reconsider. OK clears the field. Cancel leaves all as before. Speed: Brings up a dialog box containing a scroll bar with which to select various speed settings between 0.1 seconds and 100 seconds per cycle. NOTE: On slower machines the faster settings will not run as quickly as they theoretically should. This box also has the usual Windows OK and Cancel buttons. OK causes the settings to take effect. Cancel leaves all as before. Topology: Brings up a dialog box containing radio buttons for the following choices: Topology/Sheet: All four edges are boundaries. Cells off the screen are permanently empty. Topology/Cylinder: Top and bottom edges are boundaries, with cells off the screen being permanently empty. Left and right edges wrap. A pattern that runs off the left edge will reappear at the right, and vice versa. Topology/Mobius Strip: Similar to the Cylinder, except the wrapping is inverted: Top left wraps to bottom right, mirror-image. This simulates patterns drawn on a transparent Mobius strip. Topology/Toroid: All four edges wrap. Top wraps to bottom, left wraps to right. Topology/Klein Bottle: Similar to the Toroid, except the left-right wrapping is inverted: Top left wraps to bottom right, mirror-image. This simulates patterns drawn on the surface of a transparent Klein bottle. This box also has the usual Windows OK and Cancel buttons. OK causes the settings to take effect. Cancel leaves all as before. 5 Why I'm doing this I'm distributing this primarily as an attention-getter, both personal and professional. Please check out the rest of my Web page at http://www.well.com/user/bubbles/ for more on my personal side. Professionally, I've worked for many years at small companies where I was the Engineering Department (including firmware and software programming) and the specification for any new product consisted mainly of conversations with the Marketing person. Look in my Web area at http://www.well.com/user/bubbles/Resume.html for my resume. If that URL ever becomes invalid, try searching for "Digby" AND "Stancil" AND "EPROM". 6 Legal Stuff (in non-lawyer language) 6.1 Copyright This program (including icons and other related matter) is copyright 1996 by Thomas G. Digby. It is being distributed in part as a form of advertising. Permission is hereby given to copy and redistribute it provided no fee is charged, and all files listed in the Installation section of this document are distributed intact and without modification. 6.2 No Warranty I've tried to the best of my ability to make this program work as it should. It works on the various machines I've tried it on, and will very probably work on your machine. But since everybody's computer is different I can't guarantee that some unforeseen problem won't arise. If you find a bug I'd like to know about it so I can fix it, but I can't be responsible for bad things that may happen to your data or system. Just about all programs you buy have a statement like this on them somewhere, but usually in lawyer language. 7 The Future Keep checking the Web page or BBS where you found this. I plan, other projects permitting, to now and then put out improved versions with new features. 8 Document Version Last changed 2:56 p.m. October 17, 1996