Skip to content

simple C++ function to generate 2D Cellular Automata representation in one std::vector<std::vector<bool>>

Notifications You must be signed in to change notification settings

unexCoder/2D-Cellular-Automata

Repository files navigation

2D-Cellular-Automata

Simple C++ function to generate 2D Cellular Automata representation in one std::vector<std::vector>

Usage

std::vector<std::vector<bool>> cellAutom_2D ( ... )

std::vector<std::vector> cellAutom_2D (std::vector<std::vector> input, int ruleset)

Return a two dimensional boolean standard vector according to an input vector representing CA previous state and a 18 bit int encoded ruleset.

Example.

std::vector<std::vector<bool>> ca = {
 {0,0,0,0,0,0,0,0,0,0,0,0,0},
 {0,0,0,0,0,0,0,0,0,0,0,0,0},
 {0,0,0,0,0,0,0,0,0,0,0,0,0},
 {0,0,0,0,0,0,0,0,0,0,0,0,0},
 {0,0,0,0,0,0,0,0,0,0,0,0,0},
 {0,1,1,1,1,1,1,1,1,1,1,1,0},
 {0,0,0,0,0,0,0,0,0,0,0,0,0},
 {0,0,0,0,0,0,0,0,0,0,0,0,0},
 {0,0,0,0,0,0,0,0,0,0,0,0,0},
 {0,0,0,0,0,0,0,0,0,0,0,0,0}, 
 {0,0,0,0,0,0,0,0,0,0,0,0,0}
};
autom.clear();
code = ofRandom(262144);
for (int i = 0;i < NUM_ITERATIONS; i++) {
    ca = cellAutom_2D(ca,code);
    autom.push_back(ca);
}

About Cellular Automata

Two-Dimensional Cellular Automata

A new kind of science - Cellular Automata

Screenshots

3D generated graphics using Cellular Automata

--

--

--

About

simple C++ function to generate 2D Cellular Automata representation in one std::vector<std::vector<bool>>

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published