Topic 1 - Variables and Data Types
Topic 2 - Conditionals and Strings
Topic 3 - Loops
Topic 4 - Arrays
Topic 5 - File Handling
Semester 1 Projects
Topic 6 - Classes/Objects and Methods
Topic 7 - ArrayLists
Semester Projects

Part 1e: Reverse the Snake

To reverse the snake the user can press ‘r’ so that the head moves to a cell right after the last body part (tail). In the Image below, the head is surrounded by the orange circle. When ‘r’ is pressed, the head should move to the cell surrounded by the pink circle.

In SnakeProBrain.java -> reverseSnake():

You will want to follow the instructions in SnakeProData.java which outline which helper methods you could make (starting on line 431). These methods would then be used in reverseSnake(). You can create other methods if you’d like, but the suggestions are the most straight-forward way.

Tests

After this you should pass all of the test cases in the file SnakeProBrainTest_Reverse.java and be able to press the ‘r’ key during the Snake Pro game and have the snake reverse. Note – these (and all) test cases are not guaranteed to be comprehensive. It is possible that your code will have errors that are caught by these test cases and we encourage you to test the functionality within the game to try to help catch additional errors.