Skip to content

This project implements a neural network trained using a genetic algorithm from scratch to play Google's Dino Game. The network learns to make decisions (jump or duck) based on the obstacles appearing in the game.

Notifications You must be signed in to change notification settings

marlonmoratti/ChromeDinoGameAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dino Game AI with Genetic Algorithm

Dino running and dodging obstacles

Summary

📝 Description

This project implements a neural network trained using a genetic algorithm from scratch to play Google's Dino Game. The network learns to make decisions (jump or duck) based on the obstacles appearing in the game. Training of the neural network is conducted using a genetic algorithm, where the network weights are optimized to maximize performance in the game over time.

💻 Usage Instructions

Installation

Firstly, clone this repository:

git clone https://github.com/marlonmoratti/ChromeDinoGameAI.git
cd ChromeDinoGameAI

To run the scripts, you need to install some packages. We recommend using a virtual environment of your choice. In this guide, we will use venv. Make sure you have Python 3.10 installed. If you choose venv, follow these commands:

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Execution

Finally, run the command below to train the network:

python3 main.py

At the end of the training, the network weights will be saved in the file best_state.npy, and tests can be conducted using the command below:

python3 main.py --load-state

If you want to perform a single test run with game rendering enabled, use the command below:

python3 main.py --load-state --render-game

For more information, run the command below:

python3 main.py --help

✉️ Contact

If you have any questions or suggestions, feel free to open an issue or contact me directly.

About

This project implements a neural network trained using a genetic algorithm from scratch to play Google's Dino Game. The network learns to make decisions (jump or duck) based on the obstacles appearing in the game.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published