Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The begining is an example, and the assignment is written below. Please incorporate notes in the program. Like what is happening and why you did
The begining is an example, and the assignment is written below. Please incorporate notes in the program. Like what is happening and why you did some of the things you did and what algorith did you use and what did it do. Thank you! Output should show the numbers that the function is on and which direction it moved. Continuously until it hits the number on the far right.
The General Idea Write a program to read in and solve path-finding puzzles. Each puzzle consists of a sequence of integers, like this: 3 6 4 13 4 25 3 0 The orange color on the first square indicates your current position. At each step in the puzzle, you may move exactly the number of squares indicated by the integer in the square you are in. You 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 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 end of the row. In this configuration, you can solve the puzzle by making the following set of moves: Starting position 3 6 4 13 4 2 5 30 Step 1: Move right 3 6 4 1 3 4 25 3 0 Step 2: Move left 3 6 4 1 3 4 25 30 Step 3: Move right 3 6 4 1 3 4 25 30 Step 4: Move right 3 6 4 13 425 3 0 Step 5: Move left 3 6 4 1 3 4 2 5 30 Step 6: Move right 3 6 4 1 3 4 25 30 Even though this example is solvable-and indeed has more than one solution-some puzzles of this form may be impossible, such as the following one In this example, you can bounce between the two 3's, but you cannot reach any other squares Assignment: Write a function called solve which takes a list of integers (the problem) representing the elements of the puzzle, and tries to find a path from the first location to the last location. Implement your solution to this problem as one of: A* search; beam search; breadth-first search; depth-first search; or iterative deepeningStep 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