Assignment #6: Nibbler


This time you program an entire computer game (it's a long way from the boring Fibonacci numbers to something over-exciting like this!).

The game is 'Nibbler', or 'Snakes', a classic. A snake is placed into a maze (don't ask me why) and does what snakes in mazes are told to do: eating dots. In order to do so it moves through the maze; and when its head reaches a dot, the dot is eaten. Each 5th move the snake grows, no matter if it's eating dots or not.

This picture gives you an idea about the maze and the snake:

The picture also shows all of the framework provided. You can download (below) the code to generate this image, the code contains everything to build, print and use the maze, it also contains the basic code to handle a snake (the drawing of the snake) as well as a Main class, that puts these things together to give you an idea how to work with it. You receive the following files:


Here are some constraints:


Here's the code: NIBBLER


That's it, enjoy !