Skip to content

Latest commit

 

History

History
54 lines (39 loc) · 1.7 KB

README.md

File metadata and controls

54 lines (39 loc) · 1.7 KB

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

--

--

--