Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bouvens/griffeath-machine
A Cyclic Cellular Automaton
https://github.com/bouvens/griffeath-machine
canvas cellular-automata cellular-automaton cyclic-cellular-automation javascript react
Last synced: 2 months ago
JSON representation
A Cyclic Cellular Automaton
- Host: GitHub
- URL: https://github.com/bouvens/griffeath-machine
- Owner: bouvens
- License: other
- Created: 2017-10-21T16:12:03.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-03-08T17:10:37.000Z (11 months ago)
- Last Synced: 2024-03-09T17:55:19.955Z (11 months ago)
- Topics: canvas, cellular-automata, cellular-automaton, cyclic-cellular-automation, javascript, react
- Language: JavaScript
- Homepage: https://bouvens.github.io/griffeath-machine/
- Size: 6.8 MB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Griffeath’s Machine
### [Demo](https://bouvens.github.io/griffeath-machine/)
[![Example of a frame](https://github.com/bouvens/griffeath-machine/raw/master/img/griffeath-machine.png)](https://bouvens.github.io/griffeath-machine/)
This experiment is made with [state-control ![npm][npm-badge]][npm]
[npm-badge]: https://img.shields.io/npm/v/state-control.png?style=flat-square
[npm]: https://www.npmjs.org/package/state-control## What’s This?
This cyclic cellular automaton is a kind of automaton rule invented by David Griffeath and studied by several other researchers.
You can find more information and rules in [Wikipedia](https://en.wikipedia.org/wiki/Cyclic_cellular_automaton).
Rendering is made with high performance method `CanvasRenderingContext2D.putImageData()` with typed arrays and some bitwise magic inside React component [``](https://github.com/bouvens/griffeath-machine/blob/master/src/components/optimized/CanvasField.jsx).
## How It Works?
On every step [every cell changes](https://github.com/bouvens/griffeath-machine/blob/master/src/utils.js) its value to make it equal to a neighbor’s value if it has modular value one unit larger.
## How to Run Locally
Run in bash
```bash
git clone [email protected]:bouvens/griffeath-machine.git
cd griffeath-machine
npm install
npm start
```Also, there’s the script for local build
```bash
npm run build
```