👾 Conway's Game of Life implemented in Erlang.
You'll need an Erlang installation, including rebar3
.
$ rebar3 escriptize
A bit of the image processing is shunted to Haskell. You don't have to build this yourself if you don't want to.
$ ghc -O2 renderFrame/render.hs
$ _build/default/bin/conway <pattern_name>
$ _build/default/bin/conway pulsar # for example
Writes out to /tmp/conway/gif.gif
by default.
I stole a bunch of Oscillators from the
Wikipedia
article on the subject. You can call them by name as the first argument to the
conway
executable under Run. They are:
To run your own simulation, you might edit src/conway.erl
and add your own
case under main()
. Here's the full definition for blinker
:
"blinker" -> board:init( [0,0,0,0,0
,0,0,1,0,0
,0,0,1,0,0
,0,0,1,0,0
,0,0,0,0,0], 2, {5,5});
Or, in general,
"<title>" -> board:init( [<starting_state>]
, <frames_to_draw>
, {<width>, <height>}
);
Then you can rebuild with escriptize
and rerun with the new <title>
, as
above.