Skip to content

IanRPage/AlgoSnake

Repository files navigation

AlgoSnake

Class COP3530 (Summer 2025)
Group 72
Team Members: Hannah Dixon, Daniel Rodriguez, Ian Rodriguez-Page


Demo

This repo contains the C++ source code and assets for building and running our algorithmic snake game. Traditionally, the snake game is played by a user attempting to eat as much food on the board as possible. Eating food causes the length of the snake to grow and thereby taking up valuable space on the board. Eventually it becomes difficult to reach the next food because there are not many free spaces available to traverse. The game ends when all available spaces are taken up by the snake (theoretically possible) or the snake hits a wall or itself.

In the case of this project, the snake is being played by a pathfinding algorithm. Running the game allows you to choose either BFS or A*. The path finding algorithm will then continuously calculate the path to each food. If no path is found the snake will continuing moving until hopefully a new path is opened up (e.g. the snake's body is out of the way) The project is meant to compare the performance of two different path finding algorithms (BFS and A*) in a dense, unweighted graph.

Prerequisites


Building


Provided that you have VS Code recognizing your tool chain, the only other step is to ensure that SFML is unzipped into the C:\SFML-2.6.2-x64\ folder as specified the CMakeLists.txt file. All dependencies are built into the main or sim executable so no need to copy paste libraries. You can click the Build, Debug, or Launch from the CMAKE pane.
Cmake Pic

Running


As mentioned, all dependencies are built in to the executable. The only thing you need to do is configure the game to your liking in the game.config file.

Line 1: Board size (e.g. a value of 20 will produce 20 x 20 game board)
Line 2: Frame rate (make sure it doesn't exceed your monitor's refresh rate)
Line 3: Cell Size (the size of each cell in the game board; useful for scaling when board size is large)

That's it! Just run the Main.exe and you can select which algorithm you want to play the snake. You can reset the game with a different algorithm once it finishes or view final stats.

Gameplay Game Over

Simulation Only


If you just want to simulate a large data set for exporting stats, you can run the Sim.exe file and specify the board size in the command line prompt. Once finished, the following stat files will be produced in the same folder:

  • AStar_stats.csv
  • BFS_stats.csv
  • summary_stats.csv

About

This is created from my group's final project for my DSA class. I like it. Link to original project: https://github.com/derodz/COP3530-Project3-AlgoSnake

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages