Ant Colony — emergence from simple decisions

Up to a thousand ants, each deciding at the decide-rate — and the colony organizes itself. RETURN (carrying food) and GATHER (food underfoot) are rules, never questions. Everything else is scored on the snapshot — follow-trail, search, explore, defend — and genuine near-ties go to the engine under a batching budget: the colony holds a few ask-tokens per sim-second, and an ant with no token falls back to the argmax rule and says so on the rung. The trail network is emergent — trails are laid by returning ants, decay, and diffuse; there is no pathfinding code. Click an ant to follow its decision stream.

What decides what

  • Two decisions are rules, full stop. An ant carrying food RETURNS; an ant standing on food GATHERS. Neither is ever put on the wire — a test scans every escalated request across a live run and asserts return and gather never appear as candidates.
  • The rest is scored, then budgeted. follow-trail, search, explore — plus defend when the spider is close — each score on the pheromone snapshot. When the top two land within 0.12 value the engine arbitrates, if the colony has an ask-token left; the budget refills at N asks per sim-second. No token → the argmax rule decides and the rung says so.
  • The trail network is emergent. Returning ants lay pheromone; the field decays and diffuses; followers steer up the gradient. There is no pathfinding code — a seeded run's food-to-nest delivery rate rising is the test that the trail works.
  • Determinism is test-pinned. Same seed, same colony — every ant's wander, gather, and delivery replays exactly. The four spec tests (trail forms, RETURN never asked, batching budget respected, determinism) run in CI.

Honest edges

  • The engine is a budgeted voice, not the boss: at the default budget of 2 asks/s a 120-ant colony decides ~120 times per sim-second, so over 99% of decisions are rules — and every one of them says so on the rung. Set the budget to 0 and the colony runs entirely on rules.
  • The ants are 3-pixel dashes on purpose: at 1000 ants the point is the field, not the individual. Click to follow one ant's stream; click empty ground to let it go.
  • Food piles are finite (400 units each) and a drained pile stops yielding — the colony can genuinely exhaust its world.
  • The scoreboard is session-only, auto-recorded at every 100th delivery: close the tab and it is gone. Nothing leaves this page.