# Elementary Cellular Automaton

## About

This is my implementation of the Elementary Cellular Automaton using Wolfram codes. It was created in rust using the Bevy game engine and was compiled to Web Assembly.

## What is the Elementary Cellular Automaton?

The Elementary Cellular Automaton is a 1-dimensional cellular automaton. There is a 2-dimensional grid for visualization purposes where each cell can be alive or dead. Each cell follows the same rule, checking the cell directly above it as well as that cell's neighbors. Each row is a "generation" and the rows are spread vertically to visualize each generation.

## The Rules

The rule is determined by the Wolfram code given, with rules ranging from 0 to 255. Each rule can be represented in binary as a string of eight zeros or ones. Each one or zero indicates whether a cell will be alive or dead, given a certain condition. In rule 30 for example, if three cells are alive, then the new cell will be dead. These simple rules can create complex patterns.

## My Version

My version allows you to view each rule with a starting row consisting of a single alive cell or a random first row.

The controls for interaction if you are on a computer are as follows:

`W`: move view up`S`: move view down`A`: move view left`D`: move view right`Q`: zoom in`E`: zoom out`Left Mouse Button`: increase rule by 1`Right Mouse Button`: decrease rule by 1`Middle Mouse Button`: toggle random first row`Mouse Scroll`: change rule (non-web version only)

For mobile, you can only tap to increase the rule.

## Demonstration

Below is a version of the Elementary Cellular Automaton, compiled to be viewed on the web. You can interact with it by first clicking or tapping the Automaton, and then using the controls listed above. It is a 65x65 grid of cells.

Note: It may take a moment for the demonstration to load.

You can view the source code on my GitHub.