Question: Python program. Suppose an autonomous vehicle can have the following three movements on a 10 by 10 grid network: turn right (R) turn left (L)

 Python program. Suppose an autonomous vehicle can have the following three

movements on a 10 by 10 grid network: turn right (R) turn

left (L) advance (A) At any time, the vehicle can face one

of the following four directions: north, east, south, and west. If the

Python program.

Suppose an autonomous vehicle can have the following three movements on a 10 by 10 grid network: turn right (R) turn left (L) advance (A) At any time, the vehicle can face one of the following four directions: north, east, south, and west. If the vehicle faces north, it will face east if it turns right. The vehicle's location is given by a tuple (x, y), e.g., (3,8). As the vehicle moves towards east, x increases; as the vehicle moves towards north, y increases. The vehicle receives and execute instructions. The analyst is interested in the vehicle's location and in which direction it is pointing after the instructions are completed by the vehicle. Here is a string of instructions sent to the vehicle, "RAALAL", which means: o Turn right Advance twice Turn left O Advance once o Turn left In this task, we assume that the vehicle starts at (7,3) facing north. Then running this stream of instructions should leave it at (9,4) facing west. The vehicle movement can be interrupted in the following two cases: There are two walls marked in red in Table 1, which prevent the autonomous vehicle from goi through. If the vehicle attempts to go through the wall, the following message is printed: **Mission failed: vehicle crashed. The vehicle is not allowed to go beyond the 10 by 10 grid network. If the vehicle is out of the network, the following message is printed: 2 Mission failed: out of boundary." You are asked to write a Python program to report the vehicle status after the vehicle has received a series of instructions. If the vehicle has successfully executed all instructions, print: "Mission completed: Location (xxx), Direction (yyy)" You should replace "xXx" and "yyy" with appropriate information. In other cases, print either Mission failed: vehicle crashed. or Mission failed: out of boundary." Table 4-1: The 10 by 10 grid network (1,10) (10,10) (1,9) (4,9) (8,9) (1,8) (3,8) (1,7) (8,7) (1,6) (1,5) (5,5) (1.4) (9,4) (1,3) (7,3) (8,3) (1.2) (2.2) (1,1) (2.1) (3,1) (4,1) (5,1) (7,1) (8,1) (9,1) (10,1) (6,1) N Wafe S Figure 4-2: Directions For testing purposes, assume: input_instructions = ["RAALAL", "AALAARAAA", "RRAARA", "AAARALARA", "RRAAARA"]. The following results should be printed: Instructions to be executed: RAALAL Results: Mission completed: Final Location (9, 4) Final Direction: West 3 Instructions to be executed: AALAARAAA Results: Mission completed: Final Location (5, 8) Final Direction: North Instructions to be executed: RRAARA Results: Mission completed: Final Location (6, 1) Final Direction: West

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!