Skip to content

In this project, I used Q-Learning to train an AI to play the snake game.

Notifications You must be signed in to change notification settings

hamza-mughees/Reinforcement-Learning-Snake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reinforcement Learning Snake

banner

In this project, I used Q-Learning to train an AI to play the snake game.

Prerequisites

Python

NumPy

pip install numpy

PyTorch

Please navigate to pytorch.org to install the correct version of PyTorch for your machine. Below are the preferences that I selected:

  • PyTorch Build: Stable (1.8.1)
  • Your OS: Windows
  • Package: Pip
  • Language: Python
  • Computer Platform: CPU

If the above match your preferences, you can use the following command to install PyTorch:

pip3 install torch==1.8.1+cpu torchvision==0.9.1+cpu torchaudio===0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

NOTE: I would still recomend checking out pytorch.org in case of any version updates.

Installing and running

  1. Clone the repository:
git clone https://github.com/hamza-mughees/Reinforcement-Learning-Snake.git
  1. cd into the working directory:
cd Reinforcement-Learning-Snake
  1. To train the AI to play the snake game, run agent.py:
python agent.py

Releases

No releases published

Packages

No packages published

Languages