Skip to content

sher04lock/game-of-life

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Game Of Life

Game Of Life implementation in Erlang, where every living cell is represented by another process. Dead cells are just... dead. There is no need to store them as another processes.

Each cell is a gen_server supervised by cell_sup. When cell process is killed abnormally, it's automatically restarted by supervisor, without bringing the down entire application.

Running

Compile:

$ rebar3 shell

(compile & run eshell)

or

$ cd src/ 
$ erl -make

Running app (Eshell):

1> application:start(gol).

Raising cells:

universe:raiseTheDead([{0, 0}, {1, 0}, {2, 0}]).

% or with one of predefined schemas:
universe:blinker().
universe:oneForThree().

Iterating:

3> universe:tick().

Before running simulation it's recommended to open Erlang's observer using observer:start().

After generating three cells with coords {0, 0}, {0, 2}, {2, 0}:

After calling universe:tick() to generete next states:

All three cells were killed (and also corresponding processes) and one in the middle {1,1} of them was born.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages