A Golgi-stained circuit grows its dendrites and axons, wires up, then fires.
Pyramidal and stellate neurons sprout tapering dendrites as forking random walks studded with spines, and each sends out an axon whose growth cone steers by persistence, the gradients of diffusible guidance cues, attraction to other cells and repulsion from its own soma. Wherever a cone touches another cell's dendrite or soma it leaves a synapse. The grown axons then become a graph of nodes three pixels apart running FitzHugh-Nagumo dynamics, a two-variable reduction of Hodgkin-Huxley, coupled along the branches, so spikes genuinely propagate, split at forks and annihilate head on, and a spike reaching a bouton drives its target cell after a synaptic delay. Everything is drawn like a Golgi stain under brightfield optics: black silver-chromate neurons on amber tissue with more cells blurred in deeper focal planes, inked incrementally into an offscreen layer as they grow.
Try it. Click empty tissue to place an attractive guidance cue (axons steer toward it and nearby axons sprout new branches), Shift-click or right-click for a repellent, and click a cell body to fire it. Space fires a random cell and R grows a new circuit.
Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.
Build a generative drawing of neurons growing, in the style of a Golgi stain, with JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.
Start simple:
- Make a canvas that fills the window and stays sharp on high-DPI screens. Paint a warm amber background with some soft noise, like stained brain tissue under a microscope.
- Scatter about 10 cell bodies (dark blobs) with a minimum spacing between them.
- Give each cell 4 to 6 dendrite tips. Each frame, every tip moves a small step, turns by a little random angle, and draws a short dark segment that gets thinner as the branch gets longer. Now and then a tip forks into two. Stop each branch at a random length.
- Draw into an offscreen canvas that you never clear, so each frame only adds the new segments, then draw that canvas onto the screen.
- Give each cell one axon tip that grows farther and steers gently toward the nearest other cell.
Once that works, make it beautiful:
- Add tiny spines along the dendrites (short stalks with a dot at the end) and some blurred, faded cells in the background for depth.
- Let a click place a guidance cue that every axon tip steers toward, with the pull fading with distance.
- Make it fire: store each axon as a chain of points, and send a glowing pulse along it when its cell is clicked. When a pulse reaches the end of an axon near another cell, fire that cell after a short delay.
Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as replacing the pulses with FitzHugh-Nagumo dynamics on the axon graph, forming synapses only where axons touch dendrites, or repellent cues that axons avoid.