Skip to content

mcarletti/snake-ai-pytorch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Teach AI To Play Snake! Reinforcement Learning With PyTorch and Pygame

In this Python Reinforcement Learning Tutorial series we teach an AI to play Snake! We build everything from scratch using Pygame and PyTorch. The tutorial consists of 4 parts:

You can find all tutorials on my channel: Playlist

  • Part 1: I'll show you the project and teach you some basics about Reinforcement Learning and Deep Q Learning.
  • Part 2: Learn how to setup the environment and implement the Snake game.
  • Part 3: Implement the agent that controls the game.
  • Part 4: Implement the neural network to predict the moves and train it.

Getting Started

Create a conda environment with the needed modules.

conda create -n snake python=3.8
conda activate snake

pip install pygame matplotlib ipython torch torchvision

Test the game!

export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6
python -B snake_game_human.py

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%