A thousand Izhikevich neurons learn by spike timing and ripple with travelling waves.
A thousand Izhikevich model neurons, 800 regular-spiking excitatory cells and 200 fast-spiking interneurons, are wired on a ring after Izhikevich's 2006 polychronization model: each sends 100 synapses, mostly to its neighbours, with conduction delays of 1 to 20 ms that grow with distance. Synapses learn by spike-timing-dependent plasticity, strengthening when a spike arrives just before its target fires and weakening when it arrives just after, while a sliding depression threshold keeps the mean rate near 10 Hz. The opening seconds fast-forward through 30 simulated seconds of development; the weights split into the bimodal distribution STDP is known for, and activity organises into travelling waves and rhythmic population bursts with power in the gamma band. The raster scrolls like an EEG strip beside a ring where each strong synapse is a chord, spikes travel along those chords at their real delays, and the chords brighten and fade as learning continues.
Try it. Click or drag on the ring (or on a row of the raster) to stimulate that region and launch a wave; the electrode trace follows the stimulated cell. STDP toggles learning (P), Slower and Faster change the clock (arrow keys), Rewire builds a fresh network (R), and Space stimulates a random spot.
Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.
Build a spiking neural network simulation 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, stays sharp on high-DPI screens (scale by devicePixelRatio), and resizes with the window. Use a near-black background.
- Simulate 1,000 Izhikevich neurons: 800 excitatory (a = 0.02, d = 8) and 200 inhibitory (a = 0.1, d = 2), all with b = 0.2 and reset c = -65. Each simulated millisecond, update v += 0.04v^2 + 5v + 140 - u + I (as two half steps) and u += a(bv - u). When v reaches 30, record a spike, set v = c and add d to u.
- Give every neuron 100 random outgoing synapses: excitatory weight 6, inhibitory weight -5. A spike adds its weight to the target's input on the next millisecond. Add noise by giving one random neuron an input of 20 each millisecond.
- Draw a spike raster: time scrolls from right to left, one row per neuron, a dot for each spike, excitatory in amber and inhibitory in blue. Run a few simulated milliseconds per animation frame.
Once that works, make it beautiful:
- Place the neurons on a ring, connect them mostly to neighbours, and give each synapse a delay of 1 to 20 ms proportional to distance (keep a circular buffer of future inputs). Order the raster rows by ring position so travelling waves show up as diagonal streaks.
- Draw the ring beside the raster, flashing each neuron when it fires, and let me click a spot on the ring to stimulate that region.
- Plot the population firing rate under the raster like an EEG trace, with a soft glow.
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 spike-timing-dependent plasticity with a weight histogram, a power spectrum that reveals gamma rhythms, or drawing the strongest synapses as chords across the ring.