This program need to be coded by using graphics.py.
The Nibbles Game(snake)
The player maneuvers a line (by clicking direction buttons) in the limited area (there are walls around the area) which grows in length after it ate beans(after the snake ate the bean, the food will be placed in a different position), with the line itself and walls being primary obstacle.
As the snake becoming longer, it will move faster. And if the snake touched either itself or walls, game over.
I will create four buttons at the right bottom of the screen that named as ‘Up’,’Down’,’Left’,’Right’.‘UP’:controls the snake turn upward; ‘Down’: controls the snake turn downward; ‘Left’:controls the snake turn leftward; ‘Right’: controls the snake turn rightward.
(Please use win.checkMouse() method)
The snake will never stop for obtaining the food, but the user can press pause button whenever they think that they need to stop and think about the strategy of the snake’s route to get the food without touching either itself or walls around the screen.
On the initial interface, there are ‘play’, ‘introduction’,’quit’, three buttons that user can choose. After the user clicked the play button it will ask user to choose a color for the snake by entering a name of color.
In the playing interface, there are ‘pause’, the four direction buttons, and ‘quit’ at the side of the screen.
If the snake died, the ‘Play it again’ and ‘quit’ button will jump out to the center. Also, above the button, it will show the score for this play.
score calculation method: one move is considered one score, and the program will record how many moves the snake moved to get the final score.
Class going to use:
Class Button:(provided already)
Class Snake:
Class Food:
(main)Class Snake Game:
Also:
Each program should include the following:
- robust user interaction, input and output;
- loops and conditionals;
- classes, methods and instance variables for most of the functionality;
- good and clear programming techniques; and
- good documentation (including docstrings for classes and methods).
Again, user interaction should be clear, natural, and generally forgiving to the user.