/bots-for-atari-games

Bots for Atari Games using Reinforcement Learning

Primary LanguagePythonApache License 2.0Apache-2.0

Want an in-person tutorial with step-by-step walkthroughs and explanations? See the corresponding AirBnb experience for both beginner and experienced coders alike, at "Build a Dog Filter with Computer Vision" (See the 45+ 5-star reviews)

This repository includes all source code for the tutorial on DigitalOcean with the same title, including:

  • Q-table based agent for FrozenLake
  • Simple neural network q-learning agent for FrozenLake
  • Least squares q-learning agent for FrozenLake
  • Code to use fully pretrained Deep Q-learning Network (DQN) agent on Space Invaders

Each of these agents solve FrozenLake in 5000 episodes or fewer; whereas not in record time or even close to it, the agents are written with minimal tuning

created by Alvin Wan, January 2018

agent

Getting Started

For complete step-by-step instructions, see the tutorial on DigitalOcean. This codebase was developed and tested using Python 3.6. If you're familiar with Python, then see the below to skip the tutorial and get started quickly:

(Optional) Setup a Python virtual environment with Python 3.6.

  1. Navigate to the repository root, and install all Python dependencies.
pip install -r requirements.txt
  1. Navigate into src.
cd src
  1. Download the Tensorflow model for SpaceInvaders, from Tensorpack's A3C-Gym sample.
mkdir models
wget http://models.tensorpack.com/OpenAIGym/SpaceInvaders-v0.tfmodel -O models/SpaceInvaders-v0.tfmodel
  1. Launch the script to see the Space Invaders agent in action.
python bot_6_dqn.py --visual

How it Works

See the below resources for explanations of related concepts: