Page 1 of 1

Attract and Repel (revisited)

Posted: April 10th, 2024, 1:06 am
by SeanBP
Back in 2015, I made a rule set I called "Attract and Repel" and posted it in this thread: viewtopic.php?f=11&t=1751. The concept was to create a set of rules that would appear as if cells were pushing or pulling each other along. It ended up being much more interesting than I expected, with people managing to construct logic gates with it.

Now, 9 years later, I've decided to revisit this. The rules were a bit convoluted, and my coding was very poor, so I wanted to give a try streamlining it a bit, hopefully without loosing much of the interesting traits of my 2015 rules. So, here's the new rules:

Cells can take one of three states; an attractor (-1), a repeller (+1), or empty (0).

Initialize an empty grid for the next generation.

For a given attractor cell, define a vector from it to each of its non-empty neighbors, and do a vector sum.

In the next generation grid, subtract one from the neighbor cell that the vector sum is pointing to. If the angle is between two neighbors, subtract one from both. If the vector sum was zero, do nothing.

For a given repeller cell, perform this same operation, but reverse the direction of the vector sum, and add one instead of subtract one.

Once this operation has been performed over all non-empty cells, cap all values to -1, +1, and 0.

Here is a python notebook that runs this:
https://github.com/SeanBP/Attract_and_R ... epel.ipynb

And some animations I made using random seeds:
https://jmp.sh/V1y4TxJT
https://jmp.sh/qszw04eH
https://jmp.sh/tfvHIxiZ