Skip to content

👾 My interpretation of Eric Conway's Game of Life 👾

Notifications You must be signed in to change notification settings

CAM603/game-of-life

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Game of Life

A very famous cellular automaton is John Conway's Game of Life. The game is a class of discrete model known as a cellular automaton, see my rendition here.

Motivation

John Conway's Game of Life is renowned in the realm of computer science and mathematics. his game that visually demonstrates an algorithm known as cellular automaton that simulates "life" on a 2D grid. It has been recreated many times for theoretical interest and as a practical exercise in programming and data display. It was my turn.

Screenshots

Earth Configuration

Image of Earth

Glider Gun Configuration

Image of glider gun

Features

  • Preconfigured grids
    • Earth
    • Pulsar
    • Glider
    • Glider gun
    • Random
  • Generation counter
  • Generation increment control
  • Start and stop controls
  • Speed controls
  • Ability to create your own grid configuration

How To

  1. Select or create a new grid configuration.
  2. Press play or step through each generation, one at a time.
  3. Clear the grid and start again!

Code Example

Grid Generator

// Takes in a world and returns a new world based on the rules of life
export const worldBuffer = (world) => {
    let newWorld = generateWorld();
    for (let i = 0; i < GRID_SIZE; i++) {
        for (let j = 0; j < GRID_SIZE; j++) {
            let neighbors = getNeighbors(i, j, world);
            // Determine which cells live and die
            newWorld[i][j] =
                neighbors === 3 || (neighbors === 2 && world[i][j] === 1)
                    ? 1
                    : 0;
        }
    }
    return newWorld;
};

About

👾 My interpretation of Eric Conway's Game of Life 👾

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published