Question: Package Name: Source File Name: (Submit zip of these) SnakeBoard.java proj02 SnakeGame.java (contains main) Position.java C2800_Proj2_SnakeGame_Test.zip Test Files: SnakeGame is a text based snake game.






Package Name: Source File Name: (Submit zip of these) SnakeBoard.java proj02 SnakeGame.java (contains main) Position.java C2800_Proj2_SnakeGame_Test.zip Test Files: SnakeGame is a text based snake game. The snake moves around the board until it runs into itself or goes out of bounds. I realize that Snake usually has more bells and whistles, but we'll stick to a basic version for this project. The edge of the board is drawn with #'s The snake is drawn with S's The snake has 20 spaces horizontally and 10 spaces vertically where it can move . o The edge of the board is outside the 20 x 10 area Initially the snake is 2 segments long - at (1, 1) and (1, 2) o Let the positions be 0-based. (0, 0) is the upper left. o X grows positive to the right and y grows positive going down o The initial board, with the 2 initial snake segments, looks like If the snake moves to a spot already occupied by the snake or into the edge of the board, then the game is over o Keep track of the number of moves before the game ends. How to play the game (this is basically main()) Initialize the board and snake Initialize the number of moves made Print the board Continue until the game ends (snake runs into edge or itself) . o Remove the oldest segment from the snakee For example, the first time, (1, 1) will be removed from the snake Ask the user for a move (l for left, r for right, u for up, and d for down) Move the snake twice in that direction o o and the last segment added to the snake was (1,2), then add For example, if the user chooses (2, 2) and (3, 2) to the snake . Right increases the x-coordinate. So (1, 2) moves to (2, 2) and (2, 2) moves to (3, 2) I had a method in my SnakeBoard class that did a single move and called it twice. I felt this option would be more flexible if I wanted to change the game in the future Print the board Increment the number of moves made o o After the game is over, print the number of moves made
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
