A logical step forward from interactive | My Assignment Tutor

A logical step forward from interactive animated programs is games. The goal of this assignment is to program the dassic computer game, Snake. The goal of Snake is to create a snake as long as possible. This is achieved by guiding the snake to apples, lying about on the field. The snake cannot stop moving, and dies whenever it hits something. Because the snake is growing longer and longer as the game progresses, it is increasingly difficult to avoid collisions with the snake itself. At the start of the game, the snake consists of two pieces at the coordinates (0,0) and (1,0). As said before, the snake is always moving. At the start of the game, it moves to the right. When the user presses one of the arrow keys, the snake changes direction. At every moment in the game, there is always an apple somewhere in the field. If the snake hits an apple, the snake becomes one piece longer in the next screen refresh. A new apple is placed on a random location, excluding all places cov-ered by the snake. When the snake reaches the end of the screen, it will re-emerge at the other end.Example The example below shows a short game of snake, played on a 4×3 field. The game to be designed in this assignment will have a field measur-ing 32×24. The arrow indicates in which direction the snake is traveling. The numbers on the snake indicate its position in the row. startingpontion-> This assignment uses the SnakeUserInterface.


Leave a Reply

Your email address will not be published.