Skip to main content
# Simple Reflex Agent
room = "Dirty"
if room == "Dirty":
print("Action: SUCK")
else:
print("Action: DO NOTHING")
---------------------------------------------------
location = "A"
dirty = True
if dirty:
print("Room", location, "is Dirty")
print("Action: SUCK")
else:
print("Move to next room")
-----------------------------------------------------
# Environment with 4 rooms
rooms = {
"A": "Dirty",
"B": "Clean",
"C": "Dirty",
"D": "Clean"
}
# Display room status
print("Room Status:")
for room in rooms:
print("Room", room, ":", rooms[room])
-------------------------------------------------------------------
# Simple Vacuum Agent
roomA = "Dirty"
roomB = "Clean"
print("Initial Status")
print("Room A:", roomA)
print("Room B:", roomB)
# Agent starts in Room A
if roomA == "Dirty":
print("Action: SUCK")
roomA = "Clean"
print("nFinal Status")
print("Room A:", roomA)
print("Room B:", roomB)
# 1-Location Vacuum Agent
room = "Dirty"
print("Room Status:", room)
if room == "Dirty":
print("Action: SUCK")
room = "Clean"
print("Final Room Status:", room)
room = "Dirty"
if room == "Dirty":
print("Action: SUCK")
room = "Clean"
room = "Clean"
if room == "Dirty":
print("Action: SUCK")
room = "Dirty"
if room == "Dirty":
print("Action: SUCK")
room = "Clean"
print("Updated Room Status:", room)
rooms = {
"A": "Dirty"
}
rooms["A"] = "Clean"
print("Updated Room Status:", rooms["A"])
import random
color = random.choice(["Red", "Blue", "Green"])
print(color)
•There are two agents:
•Agent 1 cleans Room A.
•Agent 2 cleans Room B.
•Each agent checks if its assigned room is
Dirty.
•If the room is dirty, the agent performs the
SUCK action.
•Finally, the program displays the updated
status of both rooms
AIML_PRA_01.pdf  short description for the Reflex Agent Practical for the First AI & ML Batch.