The Assignment
Our instructor did have a knack for finding fun projects to teach us basic programming concepts that could be pretty boring otherwise. This time she wanted us to recreate the snake game (like where your snake grows every time you eat a fruit) and eventually you just get too long and run into yourself and die. She had us build this game in a very rudimentary graphic system called turtle graphics (you may remember it from school). The point was to get an object, in this case a turtle object, to be able to follow the object in front of it, so that when you created an object (segment) at the rear it would follow the object that was following the object in front of it, etc. and your snake was born.
After that you had to add some kind of detection so that if snake object hits snake object (game over) or if snake object hit randomly place fruit object (snake extends and new fruit is spawned). So that was it. The most common version of this assignment that got turned in was 1 square turtle object that extended by 1 square turtle object and did what was asked of us.

This was a pretty minimal effort but it satisfied the requirements of the assignment as was the most seen version on the assignment board.

A few were a bit more advanced with actual scores and fruit that were different colors from the snake, but still the one square following another didn’t move particularly gracefully
So that was what was required and that is what was done. But I wanted to see if I could make it a little more than that so here is what I did:

Each square segment made up of 3 sub-segments for more fluid turning.
3 speed settings for more challenging play
7 fruit levels for increasing points

5 snake titles from Garder Snake to Alien Mecha Anaconda
Containing walls or pass through walls
Stored top 10 scores list

Dozens of configurations which all calculated a difficulty level score modifier.
Configured to play with game controllers.
Compiled into a standalone installable app.

It was actually a fun, playable game.
Snakester!
My high score of nearly 600,000 points took over an hour and a half to play.
Code Example: The Snake Class:


