Skip to content

Using Reinforcement Learning and Selenium to play the Chrome No-Internet-Dino-Game

License

Notifications You must be signed in to change notification settings

a-poor/chrome-dino-solver

Repository files navigation

Chrome Dino-Game Solver

by Austin Poor

This is the code for my fifth project for the Metis Data Science Bootcamp.

For my project, I wanted to get some experience with Reinforcement Learning, so I chose to build a bot to play Chrome's No-Internet Dinosaur Game.

In case you aren't familiar, Chrome has a hidden dinosaur game, that can be accessed (if you're using Chrome) at the following link: chrome://dino. To start the game, press either the space bar or the up arrow. To play the game, use the up arrow (or space bar) to jump and the down arrow to duck. You must dodge cacti and pterodactyls for as long as possible.

Click the thumbnail above for a video of my presentation.

I've also included a copy of the presentation deck, here.


Results

I ended up building a heursitic bot (which follows pre-defined rules for choosing actions) as well as a reinforcement learning bot (which learns a policy as it plays).

The Heuristic Bot was able to get a high score of just over 16,000. For comparison, when I play my high score is about 2,500.

The Reinforcement Learning Bot was only able to get a high score of 1,300, but with a lot variation in the scores. The RL bot seemed to be able to find a good policy for dealing with the cacti but it seemed to have a hard time learning to get past the pterodactyls, which come later on in the game.

In order for the RL bot to be able to play as well as the heuristic bot, it would likely need many more iterations of training – which are especially hard given the time and memory overhead of playing the game in real-time with Chrome and Selenium.


Navigating the Repo

In order to play the game, I used selenium with ChromeDriver 80.0.3987.106.

The file dino_solve_jump_threshold.py is for creating the heuristic bot, using grid search over the thresholds.

The file dino_solver_deepQ.py is for creating the deepQ bot. (The file dino_solver_deepQ.py also references the file generate_data.py, for creating fake data as a way of pretraining the rl model.)

The folder threshold_plots/ has heatmaps that I created with dino_solve_jump_threshold.py to show what hyperparameter combinations lead to the best results.

About

Using Reinforcement Learning and Selenium to play the Chrome No-Internet-Dino-Game

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages