CISC 124 Assignment 2 Due February 13, 2004 You are to build the Snake Game, in which the player controls a snake that moves around the screen. Your goal is to move the snake to eat food. Each time the snake eats food, it gets longer. The games ends when the snake eats itself. The problem is that the snake never stops moving, and it gets hard to prevent it from running into (i.e. eating) itself. Skeleton code have been provided at http://www.cs.queensu.ca/~jstewart/124/a2.zip Read and understand the internals of all of the code, except for the internals of the Console class. You are to modify that code to implement the following features: 1. Get the Snake.feed( int amountOfFood ) method working. After that method is called, the snake should grow by the amountOfFood provided. The growth should happen gradually: The head of the snake keeps moving, but the tail remains stuck until the length of the snake has increased by the right amount. THINK about this before implementing it. 2. Get the Snake.squaredDistToSnake( int x, int y ) working. Given a location (x,y), this method returns the square of the distance from (x,y) to the closest link of the snake. You'll have to use an iterator to look through all the links. This is very similar to the hasHitSelf() method. 3. Feed the snake when it passes over some food. Place your code at "YOUR CODE HERE" in the main() procedure. When the snake passes over some food, you should (a) feed the snake, (b) update the snake length shown in the upper-left corner of the screen, (c) place a random amount (between 3 and 8 units) of new food at a random location on the screen, but not within two spaces of the snake's body, and (d) draw the new food. In placing the food randomly, you might have to make several attempts, rejecting those attempts that are too close to the snake's body. If you want (and for no extra credit) you could improve the game. For example, the snake could gradually speed up as the game progresses. Or you can have *two* snakes with *two* players simultaneously. Or obstacles that the snake can't pass through (but can hit without penalty). Or a computer-guided snake (challenging).