CAM603 / game-of-life

๐Ÿ‘พ My interpretation of Eric Conway's Game of Life ๐Ÿ‘พ

Home Page:https://game-of-life-black.vercel.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 ๐Ÿ‘พ

https://game-of-life-black.vercel.app/


Languages

Language:JavaScript 62.2%Language:CSS 31.3%Language:HTML 6.5%