Commit | Line | Data |
---|---|---|
4aa28332 SK |
1 | life-001 |
2 | ======== | |
3 | ||
4 | ||
5 | Approach | |
6 | -------- | |
7 | The grid is represented as flat list of sequential ID's, where neighbors are | |
8 | calculated using the offset relative to the desired length of the printed | |
9 | X-axis. See my prototyping doodles at the bottom. | |
10 | ||
11 | Each cell is represented as a gen_server process named after its corresponding | |
12 | ID on the grid and holding the names of its neighbors in its state record. | |
13 | ||
14 | Likewise, time is represented as a gen_server process which sends ticks to all | |
15 | cells and collects state responses, then proceeds to sort and print the | |
16 | resulting board - this constitutes one generation. | |
17 | ||
18 | Upon receipt of a tick, a cell broadcasts its state to its neighbors, then | |
19 | proceeds to collect counterpart broadcasts from its neighbors. Upon collection | |
20 | of all broadcasts - it calculates its new state and sends it to the time | |
21 | process. | |
22 | ||
23 | Additionally, there's, a non-essential, observer process, whose job is to | |
24 | simply log the statistics for each run of the simulation. | |
25 | ||
26 | ||
27 | Usage | |
28 | ----- | |
bdfda001 SK |
29 | * Get: `git clone git://github.com/ibnfirnas/life.git` |
30 | * Enter: `cd life/001` | |
31 | * Build: `make` | |
32 | * Run: `./bin/life` | |
4aa28332 SK |
33 | |
34 | ||
35 | Doodles | |
36 | ------- | |
a728f923 | 37 | ![Doodles](https://raw.github.com/ibnfirnas/cellular-automata/master/life/001/doodles.jpg) |