Skip to content

React component that renders interactive "Conway's Game of Life"

Notifications You must be signed in to change notification settings

kj455/react-life-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

👾 React life game

A React component that renders "Conway's Game of Life" 👾 .

You are a great God 👼 in this life game world, so you can control the life and death of cells by clicking on them.

lifegame

🌏 Installation

npm:

$ npm install react-life-game

yarn:

$ yarn add react-life-game

🚀 Usage

import { LifeGameField } from 'react-life-game';

function App() {
  return (
    <LifeGameField
      option={
        {
          /* option here */
        }
      }
    />
  );
}

👽 Playground

CodeSandBox

🛠️ option

option type description default
initialAliveRatio number Ratio of living cells in the initial state ([0,1]) 0.12
interval number Time per each generation ([ms]) 1000
aliveColor string Color of living cells ( can be any color that "css" can accept. i.e. blue, #1e3a8a, ... ) #1e3a8a
deadColor string Color of dead cells ( can be any color that "css" can accept. i.e. blue, #1e3a8a, ... ) #0f172b
cellSize number Size of cell ([px]) 12
width number Width of the field of game of life window.innerWidth
height numer Height of the field of game of life window.innerHeight

About

React component that renders interactive "Conway's Game of Life"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published