Sugarscape — Agent Logic & Economy


World & patches

  • Grid: 50×50 torus (wraps horizontally and vertically). Each cell stores current sugar, max sugar, and regeneration rate.
  • Patterns: Sugar can be initialized randomly or with a radial gradient; per‑tick regeneration adds back up to the cell’s max.

Agents

  • State: (x,y), sugar store, metabolism rate, base vision, per‑agent vision offset (optional variability), alive flag, and a personality: social (approach others) or anti‑social (avoid).
  • Metabolism: Each tick, agents burn sugar; reaching 0 sets alive=false (starvation).
  • Vision: Agents scan within Manhattan‑like bounds up to their (possibly varied) vision.

Decision model

  • Consider agents (toggle): If enabled, find the nearest neighbor within vision; build a unit step toward or away from them based on personality.
  • Seek sugar (toggle): Search within vision for the cell with highest sugar (ties broken by distance); build a step toward it.
  • Random drift (toggle): If no intent, pick a small random step.
  • Step choice: Candidate steps (social vs. sugar) are merged; an axis is chosen when both exist. Movement wraps on the torus.
  • Collect (toggle): On arrival, harvest sugar from the cell up to remaining capacity; sugar adds to the agent store.

UI & telemetry

  • Controls: Start/Pause/Reset, number of agents, max sugar, metabolism, vision (and variability), speed factor, regen rate, patterned vs. random sugar.
  • Stats: Sim time, agents alive, average sugar carried.
  • Event log: Recent lifecycle/behavior events (e.g., starvation), newest first.

Notes

  • Wrapping deltas ensure agents choose shortest paths on a torus. Vision variability adds heterogeneity without changing the slider’s base.
  • With collection off, you can observe movement strategies isolated from resource gain.