← all repositories
Lucifier129/factor-network

Neural nets from scratch, with Flappy Bird as the final exam

A bare-bones JavaScript neural network that learns to play games via neuroevolution, backprop, and even Monte Carlo tree search—no frameworks, no hand-waving.

532 stars JavaScript ML Frameworks
factor-network
Velocity · 7d
+0.2
★ / day
Trend
steady
star history

What it does

This is a from-scratch JavaScript implementation of a “factor network”—essentially a small neural network with multiple training modes. It learns to play Flappy Bird, recognize MNIST digits, and solve 2048 through three distinct strategies: neuroevolution (genetic algorithm-style weight mutation), classic backpropagation, and Monte Carlo methods. Everything runs in the browser via live demos.

The interesting bit

The author didn’t just slap TensorFlow.js on a canvas and call it educational. The neuroevolution demos include a telling comparison: one variant trains without labeled data (pure survival-of-the-fittest over generations), another with labeled data, plus a “Ten Masters” mode that appears to ensemble or compare multiple trained agents. The 2048 solver pairs both vanilla Monte Carlo and full MCTS—useful for seeing where tree search actually pays off.

Key highlights

  • Three Flappy Bird learning modes: pure neuroevolution, neuroevolution with labeled data, and backpropagation
  • MNIST digit recognition via backprop, running in-browser
  • 2048 solvers using both Monte Carlo sampling and Monte Carlo Tree Search
  • Zero dependencies; readable enough to trace the math by hand
  • Demos are live and linked, not buried in build scripts

Caveats

  • README is minimal: no API docs, no architecture diagrams, no performance numbers
  • “Factor network” isn’t a standard term—the relationship to conventional feedforward nets or factor graphs is unclear from the source
  • Code appears to be educational/demonstration-grade; production use would need scrutiny

Verdict

Grab this if you’re teaching (or re-learning) how neural nets actually work under the hood, or if you want to compare neuroevolution against backprop without fighting a framework’s abstractions. Skip it if you need a maintained library with docs, tests, and GPU acceleration.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.