/Pong-Q-Learning

Using Q-learning to beat a Pong game program

Primary LanguageJupyter NotebookApache License 2.0Apache-2.0

Pong Q-Learning

GitHub license

Table of Contents

About

The goal of this project is to experiment using Q-learning to beat a Pong game program. This will include programming the Q-learner, choosing hyper parameters, and quantizing the state. The assignment comprises of writing a Python-based simulation, and then a report which analyzes and explains the results.

To get started, follow their respective instructions.

Requirements

Before running the programs, you should first create a conda environment, load it, and install the requirements like so:

$ conda create -n q_learning_pong python=3.8
$ conda activate q_learning_pong
$ pip install -r requirements.txt

Running the code

In order to run the code, first, make sure you are in the correct virtual environment:

$ conda activate q_learning_pong

$ which python
/home/drkostas/anaconda3/envs/q_learning_pong/bin/python

Now, in order to train the agent you can call the Q_Learning.py directly.

$ python Q_Learning.py grid_dem alpha epsilon num_episodes check_freq file_name [agent_type]

Then, to test the agent you can call the runEpisode.py directly.

$ python runEpisode.py grid_dem file_name

License

This project is licensed under the Apache License - see the LICENSE file for details.