react-conway

Conway's Game of Life in react

Usage no npm install needed!

<script type="module">
  import reactConway from 'https://cdn.skypack.dev/react-conway';
</script>

README

react-conway

npm Build Status Maintainability Test Coverage

Demo

Usage

import React from 'react'
import { render } from 'react-dom'
import Life from '../../lib/life'

render(
    <Life/>,
    document.getElementById('react-root')
)

Check out /example to see it in action!

Properties

className: string

When set, it will be appended to the list of class names on the display element.

seed: string

When set, it this value will determine the initial state of the simulation (also known as a seed). Otherwise, the initial state will be random.

scale: number = 4

The ratio of pixels to cell. For instance, when scale is set to 4, each cell will be 4 pixels wide and 4 pixels tall.

running: bool = true

When set to true, the simulation will progress.

framerate: number = 60

Determines how many frames should be drawn in one second. Most screens these days are running at 60fps, so there's usually no need to change it. If you're expecting to run the simulation on low-power devices, you may want to set a lower framerate.