Week 11: Cellular Automata

Inspiration


This is the variation of the coding train’s project in 3D grid. Users engage by placing live cells via mouse click, adjusting speed with a slider, and observing evolving patterns. It combines interactivity, 3D visualization, and computational rules, fostering an immersive exploration.”
Let’s dive into this 3D cellular automaton project and check out its unique block design. Imagine a virtual world made up of tiny cubes – that’s our grid! Each cube, or ‘block,’ represents a cell in this three-dimensional space.

When you click your mouse on the canvas! You’re activating certain blocks within the grid. These activated blocks turn white and become part of the evolving pattern. It’s like you’re playing a creative role in shaping this digital world!

// This function draws an active block as a white cube
function drawActiveBlock(x, y, z) {
push();
translate(x * resolution - width / 2, y * resolution - height / 2, z * resolution - stacks / 2 * resolution);
fill(255, 150);
box(resolution);
pop();
}

The 'computeNext' function does all the behind-the-scenes work. It's like the brains of our project! This function uses the rules of Conway's Game of Life to decide the fate of each block based on its neighbors. If a block has too few or too many active neighbors, it 'dies' and becomes inactive. But if it has just the right number of neighbors, it 'lives' and becomes active.

Leave a Reply

Your email address will not be published. Required fields are marked *