Question: This must be a Python Program. In this assignment, you will simulate the motion of a robot inside a 20 x 20 two-dimensional grid (20

This must be a Python Program. In this assignment, you will simulate the motion of a robot inside a 20 x 20 two-dimensional grid (20 units length

and 20 units width). Depending on location of the robot, its motion is governed by different rules as described

below:

At time = 0, the robot is randomly positioned inside the grid (excluding the boundary and corners). The

first step of the robot is randomly chosen between four possible directions (left, right, forward, and

backward).

After the first step:

o If the robot is away from the boundary (meaning at least one unit away from the boundary), it

has a 50% chance of moving in the same direction as the direction it was moving in the previous

step or 50% chance of randomly choosing from the remaining three directions. Note here that to

choose the direction at a time point, the robot needs to remember what direction it moved in

the previous time step. In some sense, the robot has a short-term memory and is not a

completely random robot.

o If the robot is on the boundary (not the corner), it chooses a direction randomly from three

possibilities. In the boundary, there are only three possibilities because the robot is not allowed

to move outside of the grid.

o If the robot is at the corners, it chooses a direction randomly from two possibilities. In the

corners, there are only two possibilities because the robot is not allowed to move outside of the

grid nor it can move diagonally.

o The robot is not allowed to take diagonal steps.

First, write a python code to simulate the movement of a robot for 1000 steps. Keep track of how many times

the robot positions in the 9 different regions illustrated below. Each of the four corners (C1, C2, C3, and C4)

regions are square of 5 by 5 units; each of the four border regions (B1, B2, B3, and B4) are rectangular regions

of 10 x 5 units. The remaining region is the central region (O).

Once you are able to simulate the movement of the 100 robots. Now perform simulations of movements for

1000 robots (each robot moves 1000 steps). Now display the average time the spends in the 9 different regions.

The average should be computed over the 100 robots.

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!