An elixir implementation of Conway's game of life
Game of life is a zero player game which has four rules:
- Any live cell with fewer than two live neighbours dies, as if caused by under-population.
- Any live cell with two or three live neighbours lives on to the next generation.
- Any live cell with more than three live neighbours dies, as if by over-population.
- Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
Given these simple rules, a cell world will automatically evolve to a different world, and sometimes some life behaviours are shown, such as repeat, moving. This phenomena make it a fascinating game from a observer's perspective.
I had chosen elixir to write this game mainly for purpose of learning this new language. But from some point of view it's a very good fit for this game:
- The game is all about data transition, in a massive scale where parallism can go pretty useful
- The elixir lang's pipe operator(|>) make the process very beautiful
- The elixir lang enforced the separation of concerns which make it natural to get Engine/WebUI out of surface
- The required supervision tree design phase make this game very stable
docker run -d -p 4000:4000 benb88/game_of_life
- open Demo page to view the game