Added basic README to WolframAutomata.
[screensavers] / hacks / WolframAutomata / README.md
CommitLineData
74edf561
AT
1Overview
2========
3
4This WolframAutomata hack displays the time evolution of [elementary cellular
5automata](https://en.wikipedia.org/wiki/Elementary_cellular_automaton).
6
7These automata consist of a line of cells, each of which may be either on or
8off. To ensure every cell has neighbors, the two endpoints of the line connect
9together, thereby forming a circular universe for the cells to inhabit. This
10line is drawn horizontally on the screen.
11
12Over time, this line of cells evolves according to rules, with some cells
13switching on or off. Each new iteration is drawn below its predecessor, leading
14the screen to scroll vertically over time.
15
16The rules which govern the time evolution of this system depend only on the
17current state of a given cell and the state of its two immediate neighbors.
18These rules are formalized as
19[Wolfram codes](https://en.wikipedia.org/wiki/Wolfram_code),
20where the code number is directly convertible into a rule set.
21
22For example, the following screenshot demonstrates
23[Rule 110](https://en.wikipedia.org/wiki/Rule_110), itself Turing complete as
24discussed at length in a
25[fascinating paper](https://arxiv.org/pdf/0906.3248.pdf).
26
27![Rule 110 Animated Screenshot](/screensavers/.git/blob_plain/HEAD:/hacks/WolframAutomata/screenshot_rule_110.gif)
28
29Commandline flags are provided enabling the user to tweak attributes such as
30length and speed of simulation, cell size, rule number, colors, starting seed,
31and other attributes. For example, the screenshot below depicts Rule 73 with
32different colors than the Rule 110 screenshot. Like the Rule 110 screenshot, it
33uses `-cell-size 2` and seeds the simulation with only a single active cell.
34
35![Rule 73 Animated Screenshot](/screensavers/.git/blob_plain/HEAD:/hacks/WolframAutomata/screenshot_rule_73.gif)
36
37In situations where true randomness would lead to visually unappealing
38displays, this program provides random selection from curated lists. For
39example, to avoid randomly selecting visually indistinguishable colors like
40`dark red` and `brown` to depict on/off cells, the program includes a
41pre-selected list of color pairs that complement each other and chooses
42randomly from this list when the `-random-color` flag is passed. Similarly, to
43avoid the visually uninteresting rules like rule 0, a rule which simply turns
44every cell off and keeps it off, the program includes a list of rulesets and
45starting seeds which are visually appealing, selecting randomly from this list
46when the `-random-rule` flag is passed.
47
48
49Status
50======
51
52Complete. Tested on FreeBSD.
53
54Nearly works on Linux. The only problem resides in `WolframAutomata_free()`,
55where the call to `XFreeGC()` results in a linker error. Commenting that line
56allows WolframAutomata to build and execute on Linux, but creates a memory leak
57in the X server, resulting in its eventual termination.
58
59
60Instructions
61============
62
63The included `Makefile` includes targets for `make all` to build the hack,
64`make clean` to delete any build detritus, and `make run` to execute the hack.
65
66If you are running on FreeBSD, simply run one of those three commands. Anywhere
67else, edit the `Makefile` to suit your environment per the comments included in
68that file. Note that the `Makefile` assumes a copy of the screenhack library
69source code is located at `../screenhack/` relative to this directory.
70
71For assistance setting `$(DEFINES)` on non-FreeBSD platforms, consider
72downloading the XScreensaver source tarball, running `./configure` in the
73unpacked directory, and examining the resulting `config.h` file.
74
75Although WolframAutomata can integrate with XScreensaver, the presence of
76XScreensaver is not strictly required. WolframAutomata will both build and
77execute using only the included screenhack library.