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