Here we have 100.000 particles in two colors, white and black.
At first, they are spread randomly across the arena, only separated by their color: whites into one half of the screen, blacks into the other.
They all follow three rules (A, B and C), two of which apply to all of them equally, whereas the strength of the third is different in each one of them.
They repulse their neighbors if they come closer than 10 units (and the closer they then get, the stronger the repulsion becomes), and
They attract their neighbors if less than 20 units away.
So these two forces overlap: one is strong, but not reaching far, and the other one is weaker, yet works at a greater distance.
Resulting from this, the particles form a mesh, in which they are evenly distributed, if without displaying any regular (crystalline) structure. This mesh can be disturbed but will eventually grow together again.
If particles stray out of the boundaries of the arena, they will be placed back into their respective half (black or white), at random positions within it. Nothing is preventing them from directly crossing into the other color’s half, though.
A. and B. lead to nothing else but particles uniformly spread over the arena. Once they have arranged enough space for themselves, they won't even move anymore.
...and along comes rule C:
It defines an attraction to members of the opposite color. This attraction only gets activated if the distance to one another is underneath a threshold defined as a function of these particles’ individuality (represented by their unique, sequential number). The threshold, resulting from this individual factor, is set in such a way that the majority of particles will never experience any force towards the opposite color at all, and that the rest of them will only do so sometimes, depending on circumstances, and with a strength depending on said individual factor.
Now, clusters appear, then capsules. Whites get incapsulated by blacks, and vice versa, and in both sides of the arena. These capsules move, attracted and repulsed by one another, and they grow. As they do, the pressure on the particles being encapsulated grows, too, and some will eject themselves far and wide only to form new clusters, which in turn will influence the path of the capsules.
After some time only two capsules remain, one in each side of the arena.
•) Then on one side a grid-like structure of clusters appears, either on the left hand side, or on the right, but never in both.
•) The capsule on the opposite side tends to move along the outer edges of what would be its own grid, as if trying to form one without ever succeeding. Is it imitating the sucessful one? Or guiding it?
•) Both capsules have some sort of relationship. Whatever that might be, with rules that simple, escapes the author. However, the fact alone that only one side (or color) can, in each new run of this scenario, form a grid, hints to some sort of arrangement.
(Judge for yourself. Here is the code: dextro.org/dddd/v70so2_code.html)
What can we learn from that?
•) Self-organization always lurks around the corner, ready to jump out of the simpliest of rules. No master or master plan is needed, obviously.
•) Individual variations (which one might call personalities) are key.
•) Parallels to society are as mind-boggling as they are far-fetched. A simple code can trick us into sensing intention, and suspecting complex behaviour.
("Ringen um Ordnung" in English means "Struggling/Wrestling for Order")