Snake Game and AI Search

For my fourth year Artificial Intelligence course, our first assignment was to implement the classic game Snake. The hard part was then to implement three different search algorithms so the snake will find the food by itself. The three search algorithms were Breadth First Search, Depth First Search, and A* Search.

Each algorithm has its own advantages and disadvantages, which will be described. The modified rules for the game were that there could be obstacles, and the snake wouldn’t grow. For fun, I retained the original game’s functionality of the snake growing when it ate food.

The game was written in Java, using the Processing library. Originally I had wanted to include the game as a playable Applet, but due to security restrictions the libraries I used don’t work online. The solution is I included a zipped webpage which allows you to play the game once downloaded. Or you can compile the game yourself, I’ve included the code.

You can read more about the game here, as well as download it.

Posted in Programming | Tagged , , , | Leave a comment | 1,742 views

Leave a Comment

Your email address will not be published. Required fields are marked *