0% found this document useful (0 votes)
9 views5 pages

Reflex Agent Vacuum Cleaner

Uploaded by

rohithlaveti1822
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views5 pages

Reflex Agent Vacuum Cleaner

Uploaded by

rohithlaveti1822
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Introduction to Reflex Agents

• What is a Reflex Agent?


• • An agent that responds to the environment
directly using condition-action rules.

• Vacuum Cleaner World:


• • A simplified environment where a reflex
agent cleans dirty rooms.

• Importance:
Agent Function in Vacuum Cleaner
World
Reflex Agent Code
• class VacuumCleanerAgent:
• def __init__(self):
• self.location = 'A'
• self.environment = {'A': 'Dirty', 'B': 'Dirty'}

• def perceive(self):
• return self.environment[self.location]

• def act(self):
Code Explanation: Part 1
• 1. `class VacuumCleanerAgent:`
• - Defines the agent as a class.

• 2. `def __init__(self):`
• - Initializes the agent's location and
environment.

• 3. `self.location = 'A'`
• - Starts the agent in location 'A'.
Code Explanation: Part 2
• 4. `def perceive(self):`
• - Allows the agent to sense the current state
(clean/dirty) of its location.

• 5. `def act(self):`
• - Implements the agent's action rules:
• a. Clean the location if it's dirty.
• b. Move to the other location if it's clean.

You might also like