Skip to content

cherohn/Dino-IA-Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dino AI — Neuroevolution in Java

A Chrome Dino clone where the dinosaur learns to jump obstacles autonomously using a neural network evolved through a genetic algorithm. The AI starts blind and progressively learns obstacle avoidance through natural selection.


How It Works

Each dinosaur in the population has its own neural network. They all run simultaneously. When a dino hits a cactus, it dies. The survivors' networks are used to breed the next generation through selection, crossover, and mutation.

Input layer:
  ├── Distance to next obstacle
  ├── Height of next obstacle
  └── Current game speed

Hidden layer: learned weights

Output layer:
  └── Jump (yes/no)

The network has no knowledge of "right" or "wrong" — it only knows which individuals survived longest.


Tech Stack

Layer Technology
Language Java
UI JavaFX
Algorithm Neuroevolution (genetic algorithm)
Libraries None — fully custom implementation

Running Locally

Requirements: Java 17+, Maven 3.8+

git clone https://github.com/cherohn/Dino-IA-Java.git
cd Dino-IA-Java
mvn clean compile exec:java

Differences from Pong-IA

Pong-IA Dino-IA
Learning method Backpropagation Genetic algorithm
Training signal Error gradient Survival fitness
Population Single agent Multi-agent (population)
Game type Reactive (ball tracking) Predictive (obstacle timing)

Both projects are intentional — they explore different paradigms of machine learning applied to real-time games.


What I Learned

  • The tradeoffs between gradient-based and evolution-based learning
  • How to design a fitness function for a survival task
  • Why multi-agent simulation speeds up training compared to single-agent approaches

Author

Matheus Garcezgithub.com/cherohn

About

Chrome Dino clone where the dinosaur learns to jump obstacles via neuroevolution and genetic algorithm

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages