In this project, I used Q-Learning to train an AI to play the snake game.
pip install numpy
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.
- Clone the repository:
git clone https://github.com/hamza-mughees/Reinforcement-Learning-Snake.git
cd
into the working directory:
cd Reinforcement-Learning-Snake
- To train the AI to play the snake game, run
agent.py
:
python agent.py