Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Theory Icdt 97 6th International Conference Delphi Greece January 8 10 1997 Proceedings Lncs 1186

Authors: Foto N. Afrati ,Phokion G. Kolaitis

1st Edition

3540622225, 978-3540622222

More Books

Students also viewed these Databases questions

Question

Choosing Your Topic Researching the Topic

Answered: 1 week ago

Question

The Power of Public Speaking Clarifying the

Answered: 1 week ago