Attract and Repel (revisited, again)
Posted: December 1st, 2025, 3:13 pm
Hello!
10 years ago I posted this thread about a rule I had come up with, where cells can attract and repel other cells around it: viewtopic.php?f=11&t=1751. I later tried refining the rules, and posted it here: viewtopic.php?f=11&t=6454&p=182225#p182225, however this simplified version didn't produce as complex of a behavior as my first iteration did.
After messing around with it again, I found a better way to express the rules of the first, more interesting rule set, shown below. As this is a difficult rule set to implement into Golly, I wrote up a PyGame application to run it (which also can import/export patterns), which you can download here: https://github.com/SeanBP/Attract_and_Repel. I've also included a folder of some interesting patterns.
Video: https://imgur.com/a/v5GfB1R
Rules
Cell States:
- Empty (0): inactive
- Positive (1): attracted to neighbors
- Negative (-1): repelled from neighbors
Step Update Rules:
1. Compute Vectors:
- Around an active cell, compute two unit vectors from its neighbors:
- Cardinal: N, S, E, W neighbors weighted by absolute values
- Diagonal: NE, NW, SE, SW neighbors weighted by absolute values
- If the two vectors are exactly opposite, cancel both
2. Apply Influence:
- Choose neighbors along the vector's direction
- Add the cell's value (+1 or -1) to each selected neighbor in a new grid
- Do not double-count if selected by both vectors
3. Resolve New States:
- Set cell to 1 if total > 0
- Set cell to -1 if total < 0
- Set cell to 0 if total == 0
10 years ago I posted this thread about a rule I had come up with, where cells can attract and repel other cells around it: viewtopic.php?f=11&t=1751. I later tried refining the rules, and posted it here: viewtopic.php?f=11&t=6454&p=182225#p182225, however this simplified version didn't produce as complex of a behavior as my first iteration did.
After messing around with it again, I found a better way to express the rules of the first, more interesting rule set, shown below. As this is a difficult rule set to implement into Golly, I wrote up a PyGame application to run it (which also can import/export patterns), which you can download here: https://github.com/SeanBP/Attract_and_Repel. I've also included a folder of some interesting patterns.
Video: https://imgur.com/a/v5GfB1R
Rules
Cell States:
- Empty (0): inactive
- Positive (1): attracted to neighbors
- Negative (-1): repelled from neighbors
Step Update Rules:
1. Compute Vectors:
- Around an active cell, compute two unit vectors from its neighbors:
- Cardinal: N, S, E, W neighbors weighted by absolute values
- Diagonal: NE, NW, SE, SW neighbors weighted by absolute values
- If the two vectors are exactly opposite, cancel both
2. Apply Influence:
- Choose neighbors along the vector's direction
- Add the cell's value (+1 or -1) to each selected neighbor in a new grid
- Do not double-count if selected by both vectors
3. Resolve New States:
- Set cell to 1 if total > 0
- Set cell to -1 if total < 0
- Set cell to 0 if total == 0








