Source: Unstable Diffusion
Part 1
Implement a cellular automaton with the following rules:
- If you have no neighbors, don’t move (important, I forgot this one for a while)
- Otherwise:
- Calculate a potential move:
- If you have no neighbors to the north, move north
- If not, check likewise for south, then west, than east
- If no other agent is moving to the same space, move to your potential move
- Otherwise, don’t move
- Calculate a potential move:
- On each frame, rotate the order the directions are checked in (
NSWE
,SWEN
,WENS
,ENSW
,NSWE
, …)