Skip to content

Latest commit

 

History

History
33 lines (17 loc) · 1.53 KB

README.md

File metadata and controls

33 lines (17 loc) · 1.53 KB

Elementary Cellular Automaton renderer

Check it out on GitHub pages!

screenshot of rule 110 simulation

A visualization of elementary cellular automaton written in WebAssembly text format.

Features

screenshot of rule 193 simulation with panning and zooming

You may try out any of the 256 possible rules.

Board size is customizable, and you may also pan and zoom the generated image.

Initialization can be random, or it can happen from a single 1 value on the right side of the board.

Explanation

There is a wikipedia article that explains what an elementary cellular automaton is.

Technical details

The main functionality - rule generation and rendering - are written in WebAssembly text format.

WAST code is located in the main.wast file.

Pattern generation happens on the first board_width * board_height bytes of memory, where each byte is either a 0 or a 1.

After these bytes, there are canvas_width * canvas_height * 4 bytes that are used to store the rendered image.

The rendered image is converted from binary to ImageData and put to a canvas.