This is a 2D-native companion to the 3D nanobot swarm sim: it re-derives the same overdamped feedback control law directly in the plane, rather than viewing the 3D swarm from the front. Each of 320 nanobots is a point-mass agent:
v_i = k·(target_i − x_i) feedback toward assigned target
+ Σ_j repel(x_i − x_j) local pairwise repulsion (j within radius r)
+ √(2D)·ξ(t) thermal (Brownian) noise, ξ ~ N(0,1)
x_i(t+dt) = x_i(t) + v_i·dt (x_i, target_i ∈ R², not R³)
Every agent is assigned the nearest unclaimed slot on the target outline (a greedy nearest-neighbor match in the plane, computed once per shape) — there is no central controller; each nanobot reacts only to its own target offset and nearby neighbors.
The four target outlines are genuine 2D analogs of the 3D shapes, built independently rather than by dropping a coordinate: Circle mirrors the sphere's uniform-shell sampling; Ring mirrors the torus by mapping its minor-loop phase into a modulated radius instead of a height, filling an annulus; Square mirrors the cube's per-face random offsets along a 4-edge perimeter; Spiral mirrors the double-helix's two π-offset strands, but instead of winding around a fixed-radius cylinder the radius itself grows with arc length, tracing an Archimedean double spiral.
- Gain k — how strongly each agent is pulled toward its target; low k makes assembly slow and wobbly, high k makes it snap into place.
- Thermal noise D — random jitter representing molecular-scale thermal agitation, integrated with a proper Euler-Maruyama step (the random kick scales with √dt, not dt); for a single decoupled agent this is an Ornstein-Uhlenbeck process whose steady-state position variance is exactly D/k, confirmed numerically against this engine's own update rule.
- Repulsion — a short-range 1/r push that keeps agents from overlapping, so the outline forms as a ring of separated points rather than collapsing to a point.
- Disrupt swarm — randomizes every position, then lets the same local feedback law re-converge the swarm with zero re-programming — self-healing distributed control.
RMS error is the root-mean-square distance of all agents from their assigned target slot; coherence is the fraction of agents within 0.12 units of their target.