Conway's Life is a form of artificial life (specifically, a cellular automaton)--one of the simplest there is. There are only a few rules:
That's all there is to it. Yet fascinating behavior arises from these simple rules. Gliders, for instance.
It turns out, if you take the little five-cell shape to the left and apply the rules of Life to it, it glides diagonally across the grid. That is, it transforms in such a way that it reproduces itself at an offset every four generations. No one invented gliders. They just happen. In fact, draw some random cells in a Life program and hit "start," and it's a good chance you'll see gliders form spontaneously. This is just the beginning: Conway's Life has a whole menagerie of recurring patterns.
Much more detailed introductions to Conway's Life are available on the web.
Here are a few links worth following:
You can play Conway's Life with nothing more than a pencil and a sheet of graph paper, but it's a lot faster to use a computer. That's where GtkLife comes in. It provides you with a scrolling 65536x65536 grid, which should be enough space for even the most complex patterns, and an optimized algorithm which can run up to hundreds of generations per second. At any time, you can save the contents of the grid to a file for later use. There are also a number of preset patterns bundled with the application.
For Life newbies, getting started is easy. Scribble generously on the Life canvas, then push the green button. You'll see various "still lifes" (unchanging shapes), blinkers, and gliders coalesce out of the ensuing chaos. If you're lucky you might see a lightweight spaceship or a pulsar. Now try to figure out why it happens!
Once you've experimented on your own for awhile, you may want to explore what
others have created in the Life Pattern Archive.
GtkLife comes with the Life Pattern Archive, a public-domain collection amassed by Alan Hensel. After installation, the patterns are available from GtkLife in a sidebar on the main window. Each pattern has a description provided by its author (some brief and some page-long), which you can read after loading by clicking the text icon on the toolbar.
A typical Life pattern explodes chaotically, then gradually settles down into small groups of predictable cells. However, Life enthusiasts have engineered patterns that are anything but typical, and most of the files in the Life Pattern Archive fall into that category. There are fleets of ships, glider guns, complex oscillators, puffer trains, breeders that grow at quadratic speed, and perhaps the most anomalous pattern of all, "Max" (pictured at left). To get an idea of just how delicately balanced Max is, let it run for awhile, then erase one little dot in the middle.
Then there are the computational patterns, of which perhaps the most impressive is a functional (though slow) prime number sieve. As it turns out, Life is Turing-Complete: given a large enough grid and enough time, it can perform any computation that a modern computer could.
For more details on the contents of the Archive, see Alan Hensel's notes.
The GtkLife main window consists of a scrollable viewport in the middle, a menubar and toolbar at top, a scrollable sidebar at the left, and a status bar at the bottom. Many of these components can be disabled from the "View" menu, and a fullscreen mode is available.
File: | New, Open, Reopen, Save, Save As, Description |
View: | Zoom in, Zoom out, Zoom 1:1 (minimum), Zoom 16:1 (maximum) |
Edit: | Cut, Copy, Paste, Preferences |
Run: | Start/Stop, Step |
At the far right of the toolbar is a slider which you can use to adjust the pattern running speed.
There are a number of ways to move the Life viewport. In addition to the scrollbars and the mouse wheel, you can use the numeric keypad (with NumLock on) to scroll the viewport up, down, right, left, or diagonally. To scroll by page, hold down the <ctrl> key. Keypad "5" recenters at (0,0).
To recenter the screen around a particular point, right-click on it. Finally the View->Goto command allows you to set the viewport coordinates directly.
Zoom operations are available from the "View" menu and from the magnifying glasses in the toolbar. At startup, the viewport is zoomed all the way out, so that one blue pixel represents one live cell. You can zoom in up to 16:1, which makes operations like drawing much easier. At zoom levels 4:1 and up, a visual grid is drawn to clearly distinguish individual cells.
Left-click on the grid to toggle a cell between alive and dead. Drag the mouse to continue drawing or continue erasing cells. If you drag to the edge of the viewport, it will scroll with you.
GtkLife supports block cut-and-paste of pattern cells. To select a block of cells, left click on one corner of the block while holding down the <shift> key, then drag to the opposite corner. If you drag to the edge, the viewport will scroll with you, so you can select as large an area as you like.
The selection can then be cut/copied and pasted via the commands in the "Edit" menu (or by using the standard Ctrl-X, Ctrl-C, and Ctrl-V keystrokes). After choosing "Paste", a highlighted rectangle will appear as you move over the grid. Left-click when the rectangle is located where you want to paste. For convenience, Unix-style pasting is also allowed: instead of using the Paste command, simply middle-click on the upper-left corner of the desired region.
If there is a currently selected region when you paste, it will be implicitly copied and used in place of the copy buffer.
Note: GtkLife pasting is "transparent"--only live cells are copied. In other words, empty cells in the source region will not overwrite live cells in the target region.
Start the pattern by clicking the green button on the toolbar. Click the button again to stop. Note that most operations are still available while the pattern is running. In particular, you can draw and cut-and-paste in the middle of a running pattern. Of course, a lone plotted cell will quickly die out!
There are two other ways to advance the pattern: Run->Step (the green arrow in the toolbar) to advance by one generation, and Run->Jump to jump ahead to a particular generation as quickly as possible.
Speed is adjustable, and is set in generations per second. You can adjust speed gradually using the '<' and '>' keys (unshifted), or directly using the Run->Speed dialog or the slider on the toolbar. By default the slider goes up to 200 generations/second, but this is not a hard maximum: it will expand if you set a higher speed by some other means. The only real limit on speed is how fast your processor can go.
The program will start to drop frames if it finds itself falling behind---that is, the next generation will be computed, but the screen will not update during that tick. This greatly improves performance, especially if you don't have 2D acceleration on your video card, but it makes the animation less smooth. If you want to temporarily disable frame skipping for the current session, deselect the "skip frames" check box in the Run->Speed dialog. To have it turned off by default, see Preferences/Run.
Pattern files are loaded and saved in the .LIF file format, version 1.05. This is a portable text-based format recognized by a number of other Life programs, including XLife and the MS Windows Life32. In addition to the cell data, a .LIF file may have a textual description of the pattern, up to 22 lines long by 78 characters wide. You can view and/or edit this description using the File->Description command.
All of the standard commands are available from the File menu: New (Ctrl-N), Open (Ctrl-O), Save (Ctrl-S), and Save As (Ctrl-A). In addition, the Reopen command (R) provides an easy way to "rewind" a pattern back to its saved state.
Only one pattern file can be loaded at a time.
A Preferences dialog can be popped up via the Edit->Preferences menu item. Changes are automatically saved to disk when you click "Okay" or "Apply". Below is a description of each option under each of the four tabs.
If you want GtkLife to go into fullscreen automatically at startup, see Preferences/View.
All of these commands (except for Edit->Preferences) operate on blocks of cells. You can select a block by shift-clicking on one corner, then dragging to the opposite corner.
Most menu operations in GtkLife have keyboard equivalents. The most common operations have one-character equivalents. As with any Gtk+ application, you can also set your own custom keybindings by typing a [ctrl] or [alt] combination while a menu item is highlighted. These bindings will be saved across program runs.
Keybindings are displayed in the menus, but here's a list of the most useful and/or non-obvious ones. Note that NumLock must be on to use the numeric keypad.
Key | Action |
---|---|
S | Start/stop the pattern |
T | Step ahead one tick |
J | Jump to a generation |
D | View/edit pattern description |
R | Reopen the current file |
F | Toggle fullscreen mode |
M | Move a block of cells |
Numeric keypad | Scroll the viewport in 8 directions |
Ctrl-Keypad | Scroll by pages |
Keypad-5 | Recenter at the middle of the world |
+ and - (unshifted) | Zoom in and out, respectively |
1, 2, 4, 8, Z | Zoom 1:1, 2:1, 4:1, 8:1, and 16:1, respectively |
< and > (unshifted) | Slow down and speed up, respectively |
Ctrl-1 through Ctrl-5 | Load a recently accessed file (Ctrl-1 is most recent) |