Question: Problem 2 Write a program that prompts the user for two x and y coordinates. The program then prints two moves that will take the
Problem 2 Write a program that prompts the user for two x and y coordinates. The program then prints two moves that will take the user from the first coordinate to the second using the shortest possible distance. Each move consists of a distance and a direction: up, down, left, right, up-left, up-right, down-left, and down-right. The directions are essentially the same as in the previous problem, though the four diagonal directions affect both the x and y coordinates. Unlike the previous problem, all distances must be positive or 0. You may use moves of distance O if you only need 1 (or O) moves to reach the destination. Hint: to find the shortest possible path, you will need to use the diagonal directions if possible. Start by deciding on a basic direction and which coordinate is closer to the target. Sample output
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
