gchapim / life_view

Conway's Game of Life implementation using Phoenix LiveView.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LiveView's Game of Life

A Phoenix LiveView implementation of Conway's Game of Life.

ezgif-7-2fad6e52d271

Details

Life is an umbrella application in order to better separate the core game context (Life) from the interface (LifeWeb). In this way, it's easier to extract the core implementation to use with other interfaces (like terminal or a different framework).

The main modules are Life.Grid (game core functions) and LifeWeb.PageLive (LiveView implementation). For now the initial input comes from the configuration defined inside config/grid.exs. As we only keep track of the alive cells, all you need to do to change the initial input is to add the two-dimensional alive positions as tuples to the List.

To-do

  • Show the current generation count
  • Add Start/Pause/Reset buttons
  • Enable initial input editing from the webpage
  • Add tick speed controls
  • Improve style

Running

  • Install dependencies with mix deps.get
  • Start Phoenix endpoint with mix phx.server

Now you can visit localhost:4000 from your browser.

About

Conway's Game of Life implementation using Phoenix LiveView.


Languages

Language:Elixir 69.7%Language:CSS 18.4%Language:JavaScript 5.1%Language:HTML 3.8%Language:SCSS 3.0%