How ns2250225/fly-flappy works
This browser-based experiment runs Flappy Bird under control of a frozen fruit-fly connectome, with PURE BRAIN, ONLINE TRAIN, and FAST MODEL modes. The main workflow is: the player starts a flight; the app advances the game and sends captured state to the brain worker; the worker encodes sensory input, simulates neural activity, decodes a flap decision, and returns activity and training results; the app applies the decision and renders the game and neural map. Training/model management and experiment history are additional branches. Worker internals and several UI handlers are only partly sampled, so uncertain links are omitted.
Main entry points: App.ts App coordinator · flyBrain.worker.ts Brain worker · FlappyGame.ts Flappy game · FlyBrain.ts Brain client
Components 20
Application UI
- App coordinator
src/App.ts - Game renderer
src/renderer/GameRenderer.ts - Brain renderer
src/renderer/BrainRenderer.ts
Flight simulation
- Flappy game
src/game/FlappyGame.ts - Bird physics
src/game/Bird.ts - Pipe obstacles
src/game/Pipe.ts - Collision checks
src/game/Collision.ts
Connectome runtime
- Brain client
src/brain/FlyBrain.ts - Brain worker
src/brain/flyBrain.worker.ts - Sensory encoder
src/brain/FlyEncoder.ts - Action decoder
src/brain/FlyDecoder.ts - Learned readout
src/brain/Readout.ts - Flight safety policy
src/brain/TrainedFlightPolicy.ts - Connectome loader
src/brain/BrainLoader.ts - Connectome assets
public/brain
Training and records
- Experiment history
src/experiment/ExperimentHistory.ts - Seeded randomness
src/experiment/SeededRandom.ts
Other components
- Player
- Browser local storage
- Browser
Connections 23
- Player → App coordinator: starts and controls
- Browser → App coordinator: runs
- App coordinator → Connectome loader: loads manifest
- Connectome loader → Connectome assets: fetches manifest
- App coordinator → Brain client: initializes and steps
- Brain client → Brain worker: dispatches requests
- Brain worker → Connectome assets: fetches connectome and model
- Brain worker → Sensory encoder: encodes game state
- Brain worker → Learned readout: infers and trains
- Brain worker → Flight safety policy: applies training policy
- Brain worker → Action decoder: decodes action
- Brain worker → Brain client: returns results
- App coordinator → Flappy game: updates and captures state
- Flappy game → Bird physics: updates
- Flappy game → Pipe obstacles: spawns and updates
- Flappy game → Collision checks: checks collisions
- App coordinator → Flappy game: applies flap decision
- App coordinator → Game renderer: renders flight
- App coordinator → Brain renderer: renders activity
- App coordinator → Experiment history: records flight results
- Experiment history → Browser local storage: reads and writes records
- App coordinator → Browser local storage: loads and saves online model
- Flappy game → Seeded randomness: seeds pipe placement