alelievr / Mixture

Mixture is a powerful node-based tool crafted in unity to generate all kinds of textures in realtime
https://trello.com/b/2JiH2Vsp/mixture
MIT License
1.18k stars 124 forks source link

Cellular Automata 1D #33

Closed ultraklei closed 2 years ago

ultraklei commented 2 years ago

What

Implementation of the 1D cellular automata (CA) with the extension to 2D, where time becomes Y coordinate and each row represents one generation of the CA.

Why

Find the visual aesthetic of this algorithm self-sufficient and interesting. It can be used for anything, as long as system properties and goals (especially visual) could be mapped onto a texture.

Details

Common

The radius of neighbor lookup is fixed and equals 1. The evaluation method determines how the state of the cell on the next generation will be evaluated:

Initial Conditions

Generates an initial state for CA by filling the top row of the texture based on the selected method. Mostly suitable for the CA with the number of states <= 3. The idea was borrowed from NKS Explorer app.

It is also applicable for CA with the number of states > 3, but some degree of accuracy may be lost.

Number Based Rule Table

Generates a rule table based on numeric (serves as a rule) and the number of states, where the number of states is used as a base for the numeric system in which the rule will be converted.

The rule has a long type in order to handle big numbers, but Mixture currently does not support this type of node, that why it is not possible to use a rule as a parameter.

I left space for other types of rule table generation by making a base class for this node. For example, it can be a string representation of the rule or random generation based on Langton's Lambda parameter.

History Stack

Generates a time evolution history of CA based on the initial state, where each row represents one evolution step and the number of steps is equal to the height of the texture.

It supports two time modes:

Output

Totalistic

What else

alelievr commented 2 years ago

Hey :) Thanks a lot for your contribution! And sorry for the merging delays.

The code organization is really good btw, good job!