Skip to content
Deep Q-Learning of Unity's Banana environment
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Deep Q-Learning of Unity's Banana environment



This project was done as part of the Udacity Deep Reinforcement Nanodegree. Some of the text in this README is adapted from the original Udacity Deep Reinforcement Learning Nanodegree repo.

This project explores Q-learning on the Unity Banana environment. For full details, see Report.pdf.

Project details

For this project, an agent is trained to navigate and collect bananas in a large, square world.

A reward of +1 is provided for collecting a yellow banana, and a reward of -1 is provided for collecting a blue banana. Thus, the goal of the agent is to collect as many yellow bananas as possible while avoiding blue bananas.

The state space has 37 dimensions and contains the agent's velocity, along with ray-based perception of objects around agent's forward direction. Given this information, the agent has to learn how to best select actions. Four discrete actions are available, corresponding to:

  • 0 - move forward.
  • 1 - move backward.
  • 2 - turn left.
  • 3 - turn right.

The task is episodic, and in order to solve the environment, your agent must get an average score of +13 over 100 consecutive episodes.

Getting Started

  1. Make sure you have the following python library dependencies:

    • pytorch
    • numpy
    • unityagents
    • pickle
  2. Clone this repository with the command git clone or simply download as a zip folder by using the green button labeled 'clone or download' on this page. Note that there is no need to separately download the Unity environment. The necessary files are included in the repo.


From root, run python src/dqn/ to train. After training is done, run python src/dqn/ to see the trained agent.

You can’t perform that action at this time.