In a the file named
snake.py, write a GUI, event-driven program that plays a version (described below) of the classic video game Greedy Snake. In the game, a snake, controlled by the user using the four keyboard arrow keys, moves around a grid, eating food that is randomly placed within the grid.
Initially, the snake is one square long, and its length increases by 1 with each piece of food that it eats. As the snake moves around the grid, each segment of the snake must follow the same path that the head of the snake takes. The game ends when the head of the snake runs into the body of the snake or runs off the board if the game is not in wraparound mode. If the game is in wraparound mode, and (for example) if the snake goes off the right side of the grid, it appears on the left side of the grid in the same row. The speed that the snake moves can be adjusted. A point is earned for each piece of food eaten, but the real measure of the player’s skill is the points per second that are earned.
Here are details on how your program should look and function: (Be sure to read this entire document before starting to code, as following the instructions I give you extended guidance and rules on how to go about developing your program.)
Here is picture showing how the window of your program should look at the start of the game (before the user interacts with any of the widgets):