ambuc / conway

👾 Conway's Game of Life implemented in Erlang

Home Page:http://jbuckland.com/conway/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

conway

👾 Conway's Game of Life implemented in Erlang.

alt text

Build

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 

Run

$ _build/default/bin/conway <pattern_name>
$ _build/default/bin/conway pulsar         # for example

Writes out to /tmp/conway/gif.gif by default.

Default Oscillators

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:

  • blinker
    alt text
  • toad
    alt text
  • beacon
    alt text
  • pulsar
    alt text
  • pentadecathlon
    alt text
  • random (seen at the top of the page)

Making A Pattern

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.

About

👾 Conway's Game of Life implemented in Erlang

http://jbuckland.com/conway/

License:Apache License 2.0


Languages

Language:Erlang 93.5%Language:Haskell 6.5%