The code in this repository will let you train a Neural Network to play Pong solely based on the input frames of the game and the results of each round.
The code in me_pong.py
is intended to be a simpler to follow version of pong.py
which was written by Andrej Karpathy.
You can play around with other such Atari games at the Openai Gym.
- Follow the instructions for installing Openai Gym here. You may need to install
cmake
first. - Run
pip install -e '.[atari]'
. - Run
python me_pong.py
If you want to see the game happen, open me_pong.py
and uncomment the following line:
# env.render()
According to the blog post, this algorithm should take around 3 days of training on a Macbook to start beating the computer.
Consider tweaking the hyperparameters or using CNNs to boost the performance further.
Note, if you want to run Andrej Karpathy's original code, run python pong.py
.
This is based off of the work of Andrej Karpathy's great blog post and code here
To see a step by step tutorial for building this, see this blog post.