Das erste der NetLogo-Experimente vom Januar 2005 besteht aus zwei kurzen Prozeduren. Zu Beginn stehen 105 turtles (density) zufällig verteilt in einer Welt von 201 × 201 Patches, keine zwei auf demselben Patch. Zwei Dauerknöpfe bewegen sie:
attract: Richtung zum Ursprung; Abstand < radius → bk 1, sonst fd 1repel: Richtung zur nächsten turtle; bk repel-strength
Mit attract allein sammeln sich alle turtles auf einem Kreis mit dem Radius radius und pendeln dort um einen Schritt vor und zurück, dicht an dicht. Mit repel allein weicht jede turtle ihrem nächsten Nachbarn aus, bis alle etwa gleich weit voneinander entfernt sind – ein fast regelmäßiges Muster über die ganze Welt, die an den Rändern geschlossen ist (Torus). Beide zusammen ergeben einen Kreis mit gleichmäßigeren Abständen; turtles, die aus dem Kreis gedrängt werden, bleiben draußen stehen, wo Anziehung und Abstoßung sich gerade aufheben. Ein Radius über 100 reicht über die Welt hinaus: Die turtles weichen dann in die Ecken aus.
Im Original waren die Dauerknöpfe zu Beginn aus; hier sind beide eingeschaltet, damit „Start“ gleich etwas zeigt. Die App ist eine Neuumsetzung von repel_attract.nlogo von Reinhard König. Was geändert wurde, steht in QUELLE.md.
The first of the NetLogo experiments from January 2005 consists of two short procedures. At the start 105 turtles (density) stand at random in a world of 201 × 201 patches, no two on the same patch. Two forever buttons move them:
attract: face the origin; distance < radius → bk 1, otherwise fd 1repel: face the nearest turtle; bk repel-strength
With attract alone all turtles gather on a circle of radius radius and swing there one step back and forth, packed closely. With repel alone each turtle backs away from its nearest neighbour until all are about equally far apart – an almost regular pattern across the whole world, which wraps around at its edges (torus). Both together give a circle with more even spacing; turtles pushed out of the circle stay outside where attraction and repulsion just cancel out. A radius above 100 reaches beyond the world: the turtles then retreat into the corners.
In the original the forever buttons were off at the start; here both are switched on so that “Start” shows something at once. The app re-implements repel_attract.nlogo by Reinhard König. Changes are listed in QUELLE.md.