The game jump it consists of a board with n positive


Problem:

"Jump It" Game

The game "Jump It" consists of a board with n positive integers in a row, except for the first column, which always contains zero. These numbers represent the cost to enter each column. Here is a sample game board with n set to 6:

0   3   80   6   57   10

The objective of the game is to move from the first column to the last column with the lowest total cost. The number in each column represents the cost to enter that column. You always start the game in the first column and have two types of moves. You can either move to the adjacent column or jump over the adjacent column to land two columns over. The cost of a game is the sum of the costs of the visited columns.

In the board shown above, there are several ways to get to the end. Starting in the first column, our cost so far is 0. We could jump to 80, ten jump to 57, then move to 10 for a total cost of 80+57+10=147. However, a cheaper path would be to move to 3, jump to 6, then jump to 10, for a total cost of 3+6+10=19.

Write a recursive solution to this problem that computes the lowest cost of the game and outputs this value for an arbitrary large game board represented as an array. Your program does not have to output the actual sequence of jumps but only the lowest cost of this sequence. After making sure that your solution works on small arrays, test your solution on larger boards with larger values of n to get a feel for the scalability and efficiency of your solution.

Implement the game in a separate class Game. Write a driver that makes use of a Game object in a public class GameDriver that has the main method.

Additional Information:

This question is from Computer Science as well as it explains about developing the game called Jump It. The game is about moving from first column to last column with lowest total cost. This game requires to be developed using Java.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: The game jump it consists of a board with n positive
Reference No:- TGS01109872

Now Priced at $65 (50% Discount)

Recommended (90%)

Rated (4.3/5)