Coder Social home page Coder Social logo

game-of-life's Introduction

John Conway's Game of Life


The Game of Life is not your typical computer game. It is a 'cellular automaton', and was invented by Cambridge mathematician John Conway.

Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically, or diagonally adjacent.

The Rules

  1. Any live cell with fewer than two live neighbours dies, as if by underpopulation.
  2. Any live cell with two or three live neighbours lives on to the next generation.
  3. Any live cell with more than three live neighbours dies, as if by overpopulation.
  4. 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. Each generation is a pure function of the preceding one. The rules continue to be applied repeatedly to create further generations.


Celular Automata

A cellular automaton is a program that operates on data typically stored in a 2D grid

A simple set of rules describes how the value in a cell on the grid changes over time, often as the result of the states of that cell's neighbors.

Each round of the simulation examines the current state of the grid, and then produces an entirely new grid consisting of the old state

This new grid becomes the "current" state of the simulation, and the process repeats. Each new grid is referred to as a generation


Turing Completeness

We say a computing system is Turing Complete if it is capable of performing arbitrary, general purpose computation.

Using a construct in The Game of Life called a glider gun, it's possible to build a rudimentary NAND gate in the Game of Life. While a NAND gate by itself isn't enough to be Turing Complete, the "infinite" grid of The Game of Life allows you to use them (or any other functionally complete operator) to build any other type of logical "circuitry" and memory, as well.

Anything computable can be computed in The Game of Life given a large enough grid and enough time. Most people, however, find JavaScript to be a far easier development medium.


Features

[x] Create a few sample cell configurations that users can load and run

[x] Add an option that creates a random cell configuration that users can run

[ ] Add additional cell properties, like color or size, and incorporate them into your visualization

[x] Allow users to specify the speed of the simulation

[x] Provide functionality to manually step through the simulation one generation at a time, as opposed to animating automatically

[ ] Allow users to change the dimension of the grid being displayed

[ ]Given a specific generation, calculate the configuration of cells at that point in time, and jump to that state, bypassing animation (i.e. skip ahead n generations).

[ ] If you have an idea for a custom feature on this list, run it by your TL or instructor

Your simulation will receive a 2 when it satisfies the following:

  • Display includes a text area that shows the current generation of cells being displayed
  • Display includes a grid of cells, at least 25x25, that can be toggled to be alive or dead
  • Display includes working buttons that start / stop the animation and clear the grid
  • Algorithm to generate new generations of cells correctly implemented
  • At least 3 features from Custom Features section successfully implemented
  • Application includes a section outlining the rules to Conway's "Game of Life"

New Patterns

To add new patterns, uncomment the save button. The save button will save the current pattern to the browser's local storage. Create a new data file, copy the existing code and swap out the array with the new pattern.

game-of-life's People

Contributors

tonomb avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.