- The snake is a single bone
- The snake begins in the middle of the screen
- The player selects a direction for the snake to move (up, down, left or right) using the arrow keys
- If the snake encounters food, the speed at which it moves increases
- If the snake hits the side of the screen, it dies
- Food appears at the start of the game in a random location in the screen
- Each time a piece of food is eaten, another piece of food appears at a random location on the screen
We have provided a detailed walkthrough of the steps needed to code up short snake using principles of object oriented programming. We recommend all but the most intrepid of coders follow the walkthrough!
A fully working version of the code is provided here, and we recommend all coders execute this code (and play a few games) to get familiar with how the game works.