All Projects → BeyondScheme → elixir-game_of_life

BeyondScheme / elixir-game_of_life

Licence: other
Game of Life in Elixir. Distributed Game of Life with Board Server API. Run it on multiple nodes.

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to elixir-game of life

game of life-elixir
An implementation of Conway's Game of Life in Elixir
Stars: ✭ 22 (-58.49%)
Mutual labels:  game-of-life
convoca
Predict and analyze cellular automata using convolutional neural networks
Stars: ✭ 66 (+24.53%)
Mutual labels:  game-of-life
yagol
Yagol is a Conway's Game of Life sandbox game made with react. Customize the different options then create, share and watch your shapes evolve.
Stars: ✭ 31 (-41.51%)
Mutual labels:  game-of-life
MicroPython-ESP8266-Nokia-5110-Conways-Game-of-Life
Conway's Game of Life on a Nokia 5110 with WeMos D1 mini running MicroPython ESP8266
Stars: ✭ 27 (-49.06%)
Mutual labels:  game-of-life
coolrs
CoolRs is a collection of Android Renderscript effects.
Stars: ✭ 41 (-22.64%)
Mutual labels:  game-of-life
goltorus
Game of Life on the surface of a torus.
Stars: ✭ 49 (-7.55%)
Mutual labels:  game-of-life
logic-life-search
Cellular automata search program
Stars: ✭ 23 (-56.6%)
Mutual labels:  game-of-life
GameOfLife
Conway's Game of Life
Stars: ✭ 18 (-66.04%)
Mutual labels:  game-of-life
golux
Elixir game of life with Scenic demo
Stars: ✭ 12 (-77.36%)
Mutual labels:  game-of-life
melodyoflife
Melody of Life is a step sequencer using cellular automata
Stars: ✭ 38 (-28.3%)
Mutual labels:  game-of-life
c games
[Some C games] Some simple games written in C language.
Stars: ✭ 31 (-41.51%)
Mutual labels:  game-of-life
svelte-game-of-life
Conway's Game of Life in Svelte
Stars: ✭ 14 (-73.58%)
Mutual labels:  game-of-life
GameOfLifeView
A simple Android view that displays Conway's Game of Life. I've learnt the principles of TDD doing this
Stars: ✭ 20 (-62.26%)
Mutual labels:  game-of-life
game-of-life
Conway's Game Of Life with a small evolutionary twist.
Stars: ✭ 41 (-22.64%)
Mutual labels:  game-of-life
lifeee-rs
An implementation of the Game of Life
Stars: ✭ 53 (+0%)
Mutual labels:  game-of-life
rescript-game-of-life
Game of Life in ReasonML with ReasonReact in 2020
Stars: ✭ 36 (-32.08%)
Mutual labels:  game-of-life
cellular-automata-explorer
(WIP) An interactive web app for exploring cellular automata.
Stars: ✭ 18 (-66.04%)
Mutual labels:  game-of-life
js-simulator
General-purpose discrete-event multiagent simulation library for agent-based modelling and simulation
Stars: ✭ 52 (-1.89%)
Mutual labels:  game-of-life
rlifesrc
A Game of Life pattern searcher written in Rust. 用 Rust 搜索生命游戏中的图样。
Stars: ✭ 15 (-71.7%)
Mutual labels:  game-of-life
PyGameofLife
Conway's Game of Life using python's matplotlib and numpy
Stars: ✭ 40 (-24.53%)
Mutual labels:  game-of-life

Game Of Life in Elixir

Circle CI

Game of Life

You can run game on master node and connect other nodes into cluster. Game will distribute tasks across all connected nodes.

About the project

Please see the article about the Distributed Game of Life in Elixir.

Demo

asciicast

Rules

Conway's Game of Life

The universe of the Game of Life is an infinite two-dimensional orthogonal grid of square cells, each of which is in one of two possible states, alive or dead. Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:

  • 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.

The initial pattern constitutes the seed of the system. The first generation is created by applying the above rules simultaneously to every cell in the seed—births and deaths occur simultaneously, and the discrete moment at which this happens is sometimes called a tick (in other words, each generation is a pure function of the preceding one). The rules continue to be applied repeatedly to create further generations.

How to run

Run first node and print board in loop there.

$ iex --sname node1 -S mix
GameOfLife.BoardServer.start_game
GameOfLife.GamePrinter.start_printing_board

Run second node and add from there a new cells to existing board on the first node.

$ iex --sname node2 -S mix
Node.connect :node1@Artur
Node.list
Node.self
GameOfLife.Patterns.Guns.gosper_glider |> GameOfLife.BoardServer.add_cells

Add cells to board.

cells = [{0, 0}, {1, 0}, {2, 0}, {1, 1}]
GameOfLife.BoardServer.add_cells(cells)

Add pattern to the board.

GameOfLife.Patterns.StillLifes.block |> GameOfLife.BoardServer.add_cells

GameOfLife.Patterns.Guns.gosper_glider |> GameOfLife.BoardServer.add_cells

Add pattern to the board at specific position. Move left bottom corner of the pattern to specified X and Y position.

GameOfLife.Patterns.StillLifes.block |> GameOfLife.PatternConverter.transit(-2, -3) |> GameOfLife.BoardServer.add_cells

Example of RPC.

cells = [{0, 0}, {1, 0}, {2, 0}, {1, 1}]
:rpc.call(:n1@Artur, GameOfLife.BoardServer, :add_cells, [cells])

How patterns are defined?

For example GameOfLife.Patterns.StillLifes.block is defined in a way the last row contains cells for the bottom row of the pattern. Left bottom corner of the pattern is at {0, 0} position. The pattern is always at positive X and Y axis.

Installation

https://hex.pm/packages/game_of_life

If available in Hex, the package can be installed as:

  1. Add game_of_life to your list of dependencies in mix.exs:

    def deps do [{:game_of_life, "~> 1.0.0"}] end

  2. Ensure game_of_life is started before your application:

    def application do [applications: [:game_of_life]] end

Documentation

Documentation online: https://hexdocs.pm/game_of_life

How to generate documentation on your machine:

$ mix hex.docs
$ open doc/index.html

About Beyond Scheme

Game Of Life in Elixir is maintained by BeyondScheme.com

Yet another software engineers, are we? We build web applications on a daily basis.

See what we do or hire us to help you with your product.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].