Fly brain maze
Real fruit fly brains, wired from the FlyWire connectome, steering flies through a 3D maze.
- Drawing
- DWG 06
- Revision
- 1.0
- Year
- 2026
- Role
- Author
- Status
- Public
- Type
- Simulation, Neuroscience, Open source
- Tools
- Python, NumPy, Numba, JavaScript, Web Workers, three.js

Each fly runs a spiking model of the whole adult fruit fly brain, 138,639 neurons and 15 million connections, wired exactly as mapped by FlyWire. It smells food at its two antennae, the activity spreads through the real wiring, and its steering is read from the neurons that turn walking flies. Nothing about the maze is programmed into the brain.
Idea
FlyWire mapped every neuron and synapse in an adult fruit fly brain. I wanted to know what that wiring does on its own if you give it a body and a reason to move: put the fly in a maze, put food at the exit, and see whether the copied brain finds it.
The fly smells the food at its left and right antenna. That smell drives its real olfactory receptor neurons, and steering comes out of 40 descending neurons, including DNa01, DNa02 and DNa04, the ones known to turn walking flies.


What is real
The brain is copied, not designed. These parts come straight from published data.
- 01
Wiring
The FlyWire v783 connectome (Dorkenwald et al. 2024, Schlegel et al. 2024): every neuron and synapse.
- 02
Neuron model
The leaky integrate-and-fire model and settings from Shiu et al. 2024 in Nature, checked by reproducing their result that sugar taste neurons drive the MN9 feeding motor neuron.
- 03
Senses
Vinegar-tuned olfactory receptor neurons for food, pheromone receptor neurons for other flies, and small-object visual neurons for seeing them, with walls blocking the view.
What I had to add
Closing the loop between a brain and a body took a few modelling choices, each one stated in the repo.
- A
Synapse fatigue
Without it the antennal lobe’s local neurons drive each other into runaway firing. Short-term depression, which is documented in the fly antennal lobe, stops it.
- B
Steering readout
With the brain held still, I played smell from the left, the right and both sides and recorded all 1,303 descending neurons. The 40 that best tell left from right became one steering signal, fit on two recordings and checked on a third.
- C
Body
The fly walks at a fixed 8 mm/s with some random wandering and turns away from walls. The brain only decides which way to turn.
Smell vs no smell
The same 3×3 maze, start top left, food at the star. The fly that can smell reaches the food; the flies without smell wander.

Results
- No smell
- Found the food in 12 of 24 mazes (3×3, 90 s limit)
- Smell, steering gain 6
- 10 of 12, median 48 s
- In the browser
- 14 of 16 with smell and 6 of 16 without (60 s limit)
- Speed
- One fly runs at roughly real time on a laptop
Can a weaker fly gain from a group?
One fly had its food smell removed and ran the same 16 mazes alone, with three normal flies, and with three normal flies that mark the food once they reach it. With only the copied wiring the group doesn’t help: pheromone input hardly reaches the steering neurons, and seeing another fly mostly makes a fly turn away. With the food mark, the weaker fly usually arrived within about 15 s of the first normal fly.

Try it
The browser version needs no install: it runs every fly’s brain in Web Workers, works like a PhET simulation, and lets you change the maze, the number of flies, smell, steering and individuality, or switch off whole brain regions. A Solo vs Pack mode races one fly against a group. The Python app adds presets, replays and a brain panel for every fly.
