Skip to content

j1unt/Snake-Game-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Using a simple neural network to play a snake game

This Python project uses a simple PyTorch neural network to play a snake game (same rules as https://www.googlesnake.com/). The goal of the project was to get effective results and learn about machine learning and related libraries.

The snake game itself was created using Turtle graphics.

Installation:

With PyTorch installed, clone the repository or download the three .py files and run SnakeBot.py.

Current state of the project:

Snake moves towards the food and generally survives, but does so in a convoluted way.

Games only last 80 moves in this video.

Snake.Example.mp4

Current goals for the project:

Training sets from over 10,000 games played usually make the snake run in a circle. Planning to give more valuable input to discourage simply surviving, and tweak the model structure to train more effectively.

Turtle graphics is a major inhibitor for training efficiency since it requires turtle objects to be created for a game to run. I may implement a workaround in the future, or switch to a different graphics library entirely.

About

Using a basic neural network to play the snake game for me.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages