{"id":15288028,"url":"https://github.com/beyondscheme/elixir-game_of_life","last_synced_at":"2025-04-13T06:31:58.309Z","repository":{"id":47539408,"uuid":"55862396","full_name":"BeyondScheme/elixir-game_of_life","owner":"BeyondScheme","description":"Game of Life in Elixir. Distributed Game of Life with Board Server API. Run it on multiple nodes.","archived":false,"fork":false,"pushed_at":"2016-06-23T22:28:10.000Z","size":268,"stargazers_count":56,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-12T12:55:39.239Z","etag":null,"topics":["elixir","game-of-life"],"latest_commit_sha":null,"homepage":"http://beyondscheme.com/2016/distributed-game-of-life-in-elixir","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BeyondScheme.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-09T19:11:45.000Z","updated_at":"2023-09-01T08:47:41.000Z","dependencies_parsed_at":"2022-08-28T18:01:19.948Z","dependency_job_id":null,"html_url":"https://github.com/BeyondScheme/elixir-game_of_life","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeyondScheme%2Felixir-game_of_life","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeyondScheme%2Felixir-game_of_life/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeyondScheme%2Felixir-game_of_life/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BeyondScheme%2Felixir-game_of_life/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BeyondScheme","download_url":"https://codeload.github.com/BeyondScheme/elixir-game_of_life/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248674658,"owners_count":21143760,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","game-of-life"],"created_at":"2024-09-30T15:43:52.327Z","updated_at":"2025-04-13T06:31:57.859Z","avatar_url":"https://github.com/BeyondScheme.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Game Of Life in Elixir\n\n[![Circle CI](https://circleci.com/gh/BeyondScheme/elixir-game_of_life.svg?style=svg)](https://circleci.com/gh/BeyondScheme/elixir-game_of_life)\n\n![Game of Life](images/game_of_life_logo_small.png)\n\nYou can run game on master node and connect other nodes into cluster.\nGame will distribute tasks across all connected nodes.\n\n## About the project\n\nPlease see the article about the [Distributed Game of Life in Elixir](http://beyondscheme.com/2016/distributed-game-of-life-in-elixir).\n\n## Demo\n\n[![asciicast](https://asciinema.org/a/44233.png)](http://beyondscheme.com/2016/distributed-game-of-life-in-elixir#demo)\n\n## Rules\n\n[Conway's Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life)\n\nThe 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:\n\n* Any live cell with fewer than two live neighbours dies, as if caused by under-population.\n* Any live cell with two or three live neighbours lives on to the next generation.\n* Any live cell with more than three live neighbours dies, as if by over-population.\n* Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.\n\nThe 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.\n\n## How to run\n\nRun first node and print board in loop there.\n\n    $ iex --sname node1 -S mix\n    GameOfLife.BoardServer.start_game\n    GameOfLife.GamePrinter.start_printing_board\n\nRun second node and add from there a new cells to existing board on the first node.\n\n    $ iex --sname node2 -S mix\n    Node.connect :node1@Artur\n    Node.list\n    Node.self\n    GameOfLife.Patterns.Guns.gosper_glider |\u003e GameOfLife.BoardServer.add_cells\n\nAdd cells to board.\n\n    cells = [{0, 0}, {1, 0}, {2, 0}, {1, 1}]\n    GameOfLife.BoardServer.add_cells(cells)\n\nAdd pattern to the board.\n\n    GameOfLife.Patterns.StillLifes.block |\u003e GameOfLife.BoardServer.add_cells\n\n    GameOfLife.Patterns.Guns.gosper_glider |\u003e GameOfLife.BoardServer.add_cells\n\nAdd pattern to the board at specific position.\nMove left bottom corner of the pattern to specified X and Y position.\n\n    GameOfLife.Patterns.StillLifes.block |\u003e GameOfLife.PatternConverter.transit(-2, -3) |\u003e GameOfLife.BoardServer.add_cells\n\nExample of RPC.\n\n    cells = [{0, 0}, {1, 0}, {2, 0}, {1, 1}]\n    :rpc.call(:n1@Artur, GameOfLife.BoardServer, :add_cells, [cells])\n\n## How patterns are defined?\n\nFor example `GameOfLife.Patterns.StillLifes.block` is defined in a way the last row\ncontains 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.\n\n## Installation\n\nhttps://hex.pm/packages/game_of_life\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed as:\n\n  1. Add game_of_life to your list of dependencies in `mix.exs`:\n\n        def deps do\n          [{:game_of_life, \"~\u003e 1.0.0\"}]\n        end\n\n  2. Ensure game_of_life is started before your application:\n\n        def application do\n          [applications: [:game_of_life]]\n        end\n\n## Documentation\n\nDocumentation online: https://hexdocs.pm/game_of_life\n\nHow to generate documentation on your machine:\n\n    $ mix hex.docs\n    $ open doc/index.html\n\n# About Beyond Scheme\n\nGame Of Life in Elixir is maintained by [BeyondScheme.com](http://beyondscheme.com/?utm_source=github)\n\nYet another software engineers, are we?\nWe build web applications on a daily basis.\n\nSee [what we do or hire us](http://beyondscheme.com/?utm_source=github) to help you with your product.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeyondscheme%2Felixir-game_of_life","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeyondscheme%2Felixir-game_of_life","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeyondscheme%2Felixir-game_of_life/lists"}