Grasshopper

algorithmic modeling for Rhino

Generative Algorithms: Cellular Automata (CA)

A cellular automaton consists of a regular grid of cells, each in one of a finite number of states, "On" and "Off" for example. The grid can be in any finite number of dimensions. For each cell, a set of cells called its neighborhood (usually including the cell itself) is defined relative to the specified cell. For example, the neighborhood of a cell might be defined as the set of cells a distance of 2 or less from the cell. An initial state (time t=0) is selected by assigning a state for each cell. A new generation is created (advancing t by 1), according to some fixed rule (generally, a mathematical function) that determines the new state of each cell in terms of the current state of the cell and the states of the cells in its neighborhood.
Check wikipedia for full details and examples.

Conway Game of Life Implemented in Grasshopper and RhinoScript

 

Downloads:

CA_GameOfLife.gh

Views: 6117

Comment

You need to be a member of Grasshopper to add comments!

Comment by Rajaa Issa on February 26, 2015 at 1:54pm

Hi Lorenzo,

I updated the post with new code... This should help.

Comment by Lorenzo Franceschini on February 26, 2015 at 9:37am

Hello Rajaa, it seems that I might need your help again ;)

we're trying to set up a 2D CA, but instead of using square grid, using the distorted grid coming from PTools. (the question of yesterday).

How could we set it up?

Thanks

Comment by Nezumi on August 5, 2012 at 2:10am

And one more question.

What is the meaning of State(j)??

Is it the quantity of Points?

Comment by Nezumi on August 5, 2012 at 2:08am

hello , Rajaa Issa, i found some question about your CA script .

How does it create rows ? Why is the yNum must be smaller than xNum? 

and i feel it should go like this.

'Create rows
For i = 0 To State.Count() - 1 Step xNum
y = 0
For j = i To i + xNum - 1
Dim st As Integer
st = State(j)
SGrid(x, y) = st
y = y + 1
Next
x = x + 1
Next

Comment by KF LOK on March 2, 2012 at 5:14am

is it the problem of the original script you wrote? or it is the problem after i modified it.

thank you

Comment by KF LOK on March 2, 2012 at 5:13am

hello, i am new to the vbscript.

i had a question about the revised script, because i'm trying to modified the script you upload to fit my rules(http://www.grasshopper3d.com/forum/topics/vb-code-problem)

but i figure out that the result point with start to became blank every YNum that i set

example: if my YNum set to 25

then the result of the point will start become blank for 14 points after the 25th point in the grid, and repeating the pattern. 

Comment by Rajaa Issa on November 23, 2011 at 10:43am

Attached is a revised version of the Game of Life in grasshopper.  It fixes a bug where the new state is saved on top of the old state and it causes following cells to be incorrectly evaluated.  thanks to Leming for pointing this out.

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service