Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.
/ color-automata Public archive

Colourful cellular automaton implemented with WebAssembly.

License

Notifications You must be signed in to change notification settings

cimi/color-automata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

color-automata

This project was inspired by A Colorful Cellular Automaton in HTML5 Canvas. The original JavaScript implementation and the idea behind the algorithm were sourced from that blog post.

The project is also designed to be a proof of concept for efficiency gains when using WebAssembly (hence the alternate 'C++' implementation, see below).

The web assembly implementation allows for a higher resolution and higher frame rate (up to 10x) compared to the original JavaScript implementation. Disclaimer: I did not try to optimise the JS implementation, did not do any profiling etc.

Loading the demo page in your browser will yield a colourful tapestry. This is a form of generative art:

A typical cellular automaton consists of a grid of cells which continually change their state based upon the current states of their surrounding neighbors. A “state” may refer to a color, which may simply be black or white, as in Conway’s Game of Life. Here I allow the current RGB color of a cell to be affected by the status of the neighboring cells.

This idea (which may not be original) comes from a confusing insertion of the ideas of a flocking algorithm into a cellular automaton.

wasm-quickstart

I've extracted a minimal project setup based on create-react-app and emsdk module objects to make building this sort of stuff simpler:

'C++'

I haven't written C since University, I've never written C++. Please forgive the atrocities. Code is reasonably efficient?!

Resources