Dev runs a neural network entirely in CSS to play Flappy Bird — 20 inferences per second
JumpAppropriate714 · reddit · 2026-10-10
A developer open-sourced flappynn: a Flappy Bird clone whose "brain" is a neural network running entirely in CSS — no TensorFlow.js, no WebGPU, no hidden JS inference.
How it works: JavaScript only runs the game and feeds in state; the network itself uses CSS calc(), max() and exp() for weighted sums, ReLU activations and a sigmoid output. The latest actor is a 6→16→1 MLP (129 trainable parameters) whose inputs include bird position, velocity, pipe distance, gap position, pipe speed, and the next pipe's gap position — letting it see two pipes ahead.
Training & verification: trained with PPO across up to 512 parallel CPU environments; one 5-minute run processed 7.9M transitions over 121 PPO updates, reaching a 104.82 average score and a best episode of 514. After training, actor weights are exported to CSS and inference runs at 20 Hz (2,240 weight multiplications/sec). Comparing the browser CSS model against Python across 4,680 input states yielded zero decision mismatches with max probability error around 1.1e-16.
More from coding & agent
- Claude Opus 5.5 + Unreal Engine 5.9 used to rapid-prototype a "Wedding Videographer Simulator" — gorkem · 2026-12-02
- Dev builds Mac app that turns selected text into AI-designed posters, open-sourcing it soon — vista8 · 2026-12-02
- Every trains a writing skill on 185 posts that beats standard Claude skills 85% of the time — every · 2026-12-02
- Astral's ty type checker hits 1.0, giving OpenAI a 24x speedup over prior tooling — Simon Willison · 2026-12-02
- Agent trace eval guide: matching full-trace LLM reads at ~80% lower token cost — CShorten30 · 2026-12-02
- mdsvex 1.0 ships: full rewrite makes it a general-purpose markdown toolkit beyond Svelte — erhannah · 2026-12-02