OVERVIEW

In this project, you will implement and utilize data structures for a Java implementation of the Snake game. In this Snake game, the player controls the movement of a snake on a rectangular game board using the four arrow keys (up, down, left, right). The player earns points by eating apples on the screen. The body of the snake lengthens as it eats apples. The game is over when the snake collides with one of the four walls of the game board or with itself.

A working version of the game, which uses arrays to keep track of the position of the snake and high scores, is provided. Your main tasks in this project are to modify the program so that it uses linked lists and to increase the difficulty of the game by adding obstacles on the game board. see image.

Before you start working on the project requirements, be sure to spend time understanding the given code. The given code contains documentation that explains the purpose of each of the classes and methods. You will find incremental development very helpful as you work on the requirements of this project.

DETAILED PROJECT REQUIREMENTS

1. Define a class named Position that stores the x and y coordinates of a position. Implement any necessary accessor and mutators methods for the class.

2. Modify Board.java such that the positions of the snake joints are stored in a singly linked list. Specifically, instead of using the arrays x and y to store the x and y coordinates separately, use one singly linked list of Position objects to store the positions of the snake joints. Be sure to modify the entire program such that the singly linked list is updated whenever the snake moves.

3. Modify Board.java so that the board contains obstacles of random sizes at random locations. Use the "wall.png" image provided with the project to display the obstacles. Store the obstacles in a singly linked list of Position objects, similar to how the positions of snake joints are maintained. Modify the program such that the game is over if the snake hits an obstacle.

4. Modify Scoreboard.java such that the GameEntry objects are stored in a singly linked list, instead of an array. Be sure to modify the add and remove methods of the Scoreboard class accordingly. You may need to modify the SinglyLinkedList class to facilitate its use in the Scoreboard class.

5. Implement the reverse() method in the SinglyLinkedList class such that it reverses the elements in the list using only a constant amount of additional space (i.e. the method should not create a copy of the entire linked list). Be sure to test the method by using it to display the highest scores in the score board in reverse order.

6. Object-oriented design principles, including data encapsulation and information hiding, should be used.

7. Code should be well-documented, including all classes and class members. Follow the style guidelines for the Javadoc tool (http://www.oracle.com/technetwork/articles/java/index-137868.html).

8. All source code and runnable jar file must be submitted properly on Canvas. (IMPORTANT: if I am not able to read your source files and/or run your executable, your project will not be graded. It is your responsibility to make sure all files are submitted correctly before the deadline.)

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.