Question: I need help with C++ HW. Write a program to play a peg jumping game where the objective of the game is to leave the

I need help with C++ HW.

Write a program to play a peg jumping game where the objective of the game is to leave the fewest number of pieces on the board possible. There are solutions that end up with a single piece left, in the middle of the board. Playing the game looks like the following:

Welcome to the peg jump puzzle! Enter '-' to exit, or '+' for instructions. A B C D E F G H I J K L M N O P * Q R S T U V W X Y Z 1 2 3 4 5 6 1. Enter the peg to move: + Welcome to the peg jump puzzle. The board starts out with a single blank position, represented by the '*'. To make a move, select the letter of a peg. A peg must be able to jump over an adjacent peg into a blank position for a move to be valid. The jumped peg is then removed from the board. The game is over when there are no valid moves left. At any point enter '-' to exit, or '+' for instructions. A B C D E F G H I J K L M N O P * Q R S T U V W X Y Z 1 2 3 4 5 6 1. Enter the peg to move: E A B C D * F G H I * K L M N O P E Q R S T U V W X Y Z 1 2 3 4 5 6 2. Enter the peg to move: W A B C D * F G H I W K L M N O P * Q R S T U V * X Y Z 1 2 3 4 5 6 3. Enter the peg to move: 5 A B C D * F G H I W K L M N O P * Q R S T U V 5 X Y Z 1 * 3 4 * 6 4. Enter the peg to move: 2 *** Invalid move, please retry. *** 4. Enter the peg to move: R A B C D * F G H I W K L M N O P R * * S T U V 5 X Y Z 1 * 3 4 * 6 * * * * 1 * * * * * * * * * * * + * * * * * * * * * * * 2 * * * * Which move do you want? 1 A B C D R F G H I * K L M N O P * * * S T U V 5 X Y Z 1 * 3 4 * 6 
5. Enter the peg to move: - Pieces Remaining: 27 Done. 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!