Question
You have been given a puzzle consisting of a row of squares each containing an integer, like this: The circle on the initial square is
You have been given a puzzle consisting of a row of squares each containing an integer, like this:
The circle on the initial square is a marker that can move to other squares along the row. At each step in the puzzle, you may move the marker the number of squares indicated by the integer in the square it currently occupies. The marker may move either left or right along the row but may not move past either end. For example, the only legal first move is to move the marker three squares to the right because there is no room to move three spaces to the left.
The goal of the puzzle is to move the marker to the 0 at the far end of the row. In this configuration, you can solve the puzzle by making the following set of moves:
Even though this puzzle is solvableand indeed has more than one solutionsome puzzles of this form may be impossible, such as the following one:
In this puzzle, you can bounce between the two 3s, but you cannot reach any other squares.
Write a function bool Solvable(int start, Vector
You may assume all the integers in the vector are positive except for the last entry, the goal square, which is always zero. The values of the elements in the vector must be the same after calling your function as they are beforehand, (which is to say if you change them during processing, you need to change them back!)
bool Solvable(int start, Vector
NOTE: This assignment MUST use RECURSION.
THe image to reference on what it needs to look like is:
https://www.chegg.com/homework-help/questions-and-answers/bosition36-434-25-30-1-step-1-3-64-13-4-2-5-3-0-3-4-2-5-3-0-13-4-25-30-move-right-step-2-3-q31988137
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started