← all repositories
ivanseidel/IAMDinosaur

Screen-Scraping Survival of the Fittest

It turns Chrome's hidden offline game into a live training ground for neural networks and genetic algorithms.

2.8k stars JavaScript LearningAgents
IAMDinosaur
Not currently ranked — collecting fresh signals.
star history

What it does

IAMDinosaur is a Node.js experiment that plays Chrome’s offline dinosaur game by watching your screen. It uses RobotJS to scan pixels and measure the distance, length, and speed of upcoming cacti, then feeds that data into a neural network. The network’s output decides when the dino jumps, ducks, or idles, while a genetic algorithm evolves twelve genomes per generation—culling the worst, crossing over the survivors, and mutating the offspring.

The interesting bit

The project treats the browser as an uncooperative black box: it never touches the game’s internal state, relying entirely on screen observation and simulated keypresses. The README even documents a genuine game bug where the T-Rex slowly drifts right until the AI mistakes the dinosaur for a cactus because they share the same color.

Key highlights

  • Evolves 12 genomes per generation using fitness scores based on jumped cacti
  • Reads game state by ray-tracing pixels rather than accessing internal variables
  • Built with Synaptic for neural networks and RobotJS for screen capture and keyboard control
  • Terminal UI for saving, loading, and selecting trained genome JSON files

Caveats

  • The dino’s slow rightward drift eventually breaks the pixel scanner; the README suggests refreshing the page or injecting a console script to reset the x-position
  • Requires the terminal and browser window to sit on the same screen so screen-scraping coordinates align correctly

Verdict

A tangible sandbox for developers curious about genetic algorithms and neural networks. Skip it if you want a polished, resolution-agnostic reinforcement-learning framework that doesn’t need occasional babysitting.

Frequently asked

What is ivanseidel/IAMDinosaur?
It turns Chrome's hidden offline game into a live training ground for neural networks and genetic algorithms.
Is IAMDinosaur open source?
Yes — ivanseidel/IAMDinosaur is open source, released under the MIT license.
What language is IAMDinosaur written in?
ivanseidel/IAMDinosaur is primarily written in JavaScript.
How popular is IAMDinosaur?
ivanseidel/IAMDinosaur has 2.8k stars on GitHub.
Where can I find IAMDinosaur?
ivanseidel/IAMDinosaur is on GitHub at https://github.com/ivanseidel/IAMDinosaur.

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