Hey everyone,
I’m a student and I’m working on some kind of cellular growth simulation in Grasshopper with Anemone, but I’m stuck on a specific problem.
Basically my setup:
I have a grid, I pick a start cell (like index 55), then each a anemone loop it checks the 4 neighbours (up, down, left, right) and then it randomly picks one of them and creates a new cell there. So far this part works fine and the growth spreads around like I want it to.
The problem is: right now the system always creates a new cell.
I need it to also be able to say “no” sometimes.
I want to block creating new cells in some situations. So if 3 cells are after each other i want them to stop growing. So an Example. cell 55 cell 56 cell 57 are all active cells thats been built. Now i want them to know ah we shouldnt build a cell in cell 58 we should build around it.
I tried a bunch of things but i cant figure it out.
I’m also planning to connect this system to Galapagos later so I need the loop to be stable.
It would help so much if i get some inspirations or som e answers here
I can think of 2 ways, first one: filter candidates at the beginning of each cycle, in such a way you end up with a list of superpositions where new cells can always be generated (this comes at the expense of computational time at the beginning of each cycle to determine a list of possible candidate locations)
second way, create a nested loop that will go through the current candidate location, check if a new cell can grow there: if it can then fine, if it can’t → try another location, rinse and repeat… (I suggest a nested loop in such a way each iteration of the main loop will yeld a result, because let’s say it takes 7 tries to find a new growth location, those seven tries will be cycling in the nested loop, not the main one)