Skip to content

Repository files navigation

fruitflyworld / game

A fruit fly with a slot for a brain, in a dish that wants it dead.

10 seconds of the survival game — a judgment-brain fly foraging while the predator stalks

▶ PLAY · the exam room · the essay

MIT CI no build step


Play it live at fruitfly.world/play — or play this exact bundle on GitHub Pages — or run the same files from this repository locally (see below). No install, no account, no wallet.

The game

A single-player lineage roguelite. Each generation lasts up to 50 seconds. You forage in a dish where food carries three risk levels — sugar (+12, safe), yeast (+26, on the rim of the predator's range), rot (+38, but it exposes you for six seconds) — while a predator hunts by vision and commits to a ballistic lunge you can read. Energy above a threshold becomes eggs. At generation's end you compare eggs with the wild type and draft one mutation for the next fly. Death ends a generation, not the lineage.

The twist: you pick the brain, the brain flies

Brain What it is
manual You drive (WASD / drag). The baseline every other brain is measured against.
genes The wild type's auto-pilot: fixed gene weights steering by the same signals.
circuit FFW-CX/0.1 — a 24-neuron spiking circuit, connectome-inspired, firing at 10 Hz.
judgment A System One judgment model in the slot. Free local heuristic by default; with a key it runs a pinned jev-1.13.0 through a same-origin proxy, with visible fallback.

The escape reflex is not pluggable: underneath every brain sits the LC4/LPLC2 → Giant Fiber circuit — the command cell for the escape jump in the real fruit fly, here a leaky integrate-and-fire module. The brain chooses; the brainstem jumps. In a simplified two-channel wiring check, the fly escapes 100% of telegraphed lunges with real connectivity and 68% with swapped connectivity — evidence that channel order matters in this circuit, not a result about the connectome. The check ships in the menu.

Every decision a deciding brain makes is sealed with a content hash into a downloadable log (the genes auto-pilot logs nothing — it makes no judgment calls). Press ?bench=1 for the exam room: the same (seed, brain, generations) run twice at a fixed 60 Hz — bit-identical runs print IDENTICAL; anything else is a bug report, not a score.

Run it locally

No build step — the files the browser loads are the files in this repository:

git clone https://github.com/fruitflyworld/game
cd game
python3 -m http.server 8080   # or: npx serve .
# open http://localhost:8080

Layout

index.html          entry — loads Phaser (vendored, MIT) and js/main.js
style.css           game + exam-room UI
vendor/phaser.min.js
js/
  sim.js            the dish world: seeded RNG, mutation drafts, escape assay
  gf-neuron.js      the brainstem: LC4/LPLC2 → Giant Fiber LIF escape circuit
  cx-circuit.js     FFW-CX/0.1, 24 spiking neurons
  brain*.js         the brain contract + four implementations + the metronome
  bench.js          the exam room harness (double-run, calibration)
  scene-boot.js     menu, brain selection, control experiment
  scene-game.js     the dish: foraging, predator, generations, brains, replay
  ui.js / audio.js  HUD, drafts, i18n (en/zh), sound

The simulation core and the brain modules are the fruitflyworld/sim repository, vendored here so the game stays a drop-in static bundle. The exam harness is fruitflyworld/bench, vendored for the same reason. The canonical versions live in those repositories; changes land there first.

Two site features degrade gracefully when the game runs standalone: the Jev proxy and the beacon seed endpoint are same-origin services of fruitfly.world — without them the judgment brain uses its local heuristic and ?seed=beacon falls back to seed 42.

Honest boundaries

The world model is connectome-inspired. It is not a simulation of a real fly brain, not a FlyWire or MaleCNS runtime, and not a claim about animal behavior.

License

MIT © 2026 Fruit Fly World — including the vendored Phaser, which carries its own MIT notice in vendor/phaser.min.js.

About

The fruitflyworld survival game — a fruit fly with a slot for a brain, in a dish that wants it dead. Plain ES modules + Phaser, no build step. Play at fruitfly.world/play.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages