Skip to content

Using search algorithms to play Snake. Python and pygame.

Notifications You must be signed in to change notification settings

stschoberg/snakeGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

snakeGame

This is a project to implement different AI solutions to solve the classic snake game. All of the AI implementations are my own however the game itself is built from a tutorial by techwithtim linked below.

Here is some analysis of the algorithms

https://techwithtim.net/tutorials/game-development-with-python/snake-pygame/

Installation

git clone https://github.com/stschoberg/snakeGame.git

Usage

The game has various runmodes

  1. keys - the user plays the game with the arrowkeys
  2. random - the ai chooses a random path with no respect for the snack
  3. shortest - the ai chooses the shortest path to the snack
  4. better-shortest - the ai chooses the shortest path to the path but will avoid its own body
  5. hamiltonian - guarenteed to win. takes a while
python3 playSnakeGame.py --option # where option is a mode listed above

About

Using search algorithms to play Snake. Python and pygame.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published