Question: You have been tasked with creating a cleaning agent that can navigate and clean a set of rooms in a house. The agent will be
You have been tasked with creating a cleaning agent that can navigate and clean a set of rooms in a
house. The agent will be equipped with a vacuum cleaner and must navigate through the house to clean
all the rooms. To simplify the problem, assume that the house is a grid of rooms, each identified by its
x y coordinates. The agent can move in four directions up down, left, and right and can clean a
room by moving to it and performing a cleaning action. Your task is to implement the cleaning agent
in Python using an appropriate algorithm, such as depthfirst search or A search.
Here are the details of the scenario:
The house is a x grid of rooms, numbered to
Each room can be in one of two states dirty or clean.
The agent starts in room which is always clean.
The agent must clean all the dirty rooms in the house.
The agent can move one step at a time in any of the four directions up down, left, or right.
The agent can clean a room by moving to it and performing a cleaning action.
The agent can only move through doorways between adjacent rooms.
The agent has a limited battery life and can only clean a certain number of rooms before needing to
recharge.
To complete this task, you will need to implement the following functions:
getdirtyrooms: This function should return a list of the coordinates of all the dirty rooms in
the house.
getneighborsroom: This function should return a list of the coordinates of all the neighboring
rooms of the given room.
cleanroomroom: This function should clean the given room and return True if the cleaning
action is successful.
moveagentfromroom, toroom: This function should move the agent from the fromroom
to the toroom and return True if the movement is successful.
a You can use any appropriate algorithm to implement the cleaning agent, such as depthfirst
search, breadthfirst search, or A search.
b Once you have implemented the cleaning agent in Python, you can test it on different houses
and evaluate its performance. Draw State space diagram for each move.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
