Skip to content

This python project is a demonstration of what a genetic algorithm technique can achieve when applied in a game. The current game is the famous dinosaur game launched by google chrome.

Notifications You must be signed in to change notification settings

ifs55/Dino-genetic-algorithm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dino-genetic-algorithm

This python project is a demonstration of what a genetic algorithm technique can achieve when applied in a game. The current game is the famous dinosaur game launched by google chrome.

python modules

  • keyboard
  • Tkinter
  • numpy
  • pillow

Project scopes

In this project, there are three scopes: 'train', 'game' and 'simulation'. Each one has a different purpose to see the project running.

train

You can run training mode through the following code:

python3 main.py train

The training mode uses a pre-trained set of dinos. After executing the above command the training will continue using the best dino of the last training.

You can choose the number of dinos per generation as the 3th parameter. The default value is 10.

python3 main.py train 10

simulation

You can run the simulation mode through the following code:

python3 main.py simulation

The simulation mode is better when you want to see the dinos learning through each generation. This mode doesn't use any previous result as a start point. So each stating dino has a random behavior that changes as new generations are generated.

You can choose the number of dinos per generation as the 3th parameter. The default value is 10.

python3 main.py simulation 10

game

You can run game mode through the following code:

sudo python3 main.py game

In this mode, you can compete against the best dino you have trained. The dino with the highest score wins. When running game mode you should give root permissions because the algorithm needs access to your keyboard events.

About

This python project is a demonstration of what a genetic algorithm technique can achieve when applied in a game. The current game is the famous dinosaur game launched by google chrome.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%