Question: Consider a robot that is placed in a room. The robot can: Move forward by one unit. Turn left or right. Sense

Consider a robot that is placed in a room. The robot can:
• Move forward by one unit.
• Turn left or right.
• Sense what is in front of it: a wall, a window, or neither.

Write an algorithm that enables the robot, placed anywhere in the room, to count the number of windows. For example, in the room at right, the robot (marked as R) should find that it has two windows.

[ R

[ R

Step by Step Solution

3.40 Rating (163 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is one possible algorithm for solving this problem 1 Begin by facing the robot in any direction 2 Move forward until the robot senses a window or ... View full answer

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 Java Concepts Late Objects Questions!