Turn-Based Snake Game

From UBC Wiki

Authors: Mickey, David, Truman


What is the problem?

Fully implementing all the necessary component for the snake game in Haskell. This includes implementing the user interface, rendering the game elements, having a user-controllable and growing snake, and a win/lose condition. An example of such a game can be found here: https://playsnake.org


What is the something extra?

Unlike the typical snake game, however, the snake does not constantly move in real-time, rather, it only moves one block at a time and only on a valid user directional input. Will also have two heads, one pointing to the greedy path towards food, the other pointing to the "smart" path to the food. Both heads have will attempt to commit to the current direction if possible/optimal, will avoid lose-conditions, and try to reach the food with the least number of turns


What did we learn from doing this

We learned the difficulty of translating our ideas to the a strongly functional language, and how to implement algorithms, game states, and grid-based locations using tuples in Haskell.


Code

https://github.com/MickeyZYF/Greedy-Smart-Turn-Based-Snake-Game