Skip to content

ambuc/conway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published