# 1)170030971.docx - AI-SKILLING QUESTION 170030971 Q.1 In...

• 4

This preview shows page 1 - 4 out of 4 pages.

AI-SKILLING QUESTION 170030971 Q.1. In terms of intelligent agent implement vacuum-cleaner world problem in python for just two locations Python Code: import random class Environment(object): def __init__(self): self.locationCondition = {'A': '0', 'B': '0'} self.locationCondition['A'] = random.randint(0, 1) self.locationCondition['B'] = random.randint(0, 1) class SimpleReflexVacuumAgent(Environment): def __init__(self, Environment): print (Environment.locationCondition) Score = 0 vacuumLocation = random.randint(0, 1) if vacuumLocation == 0: print ("Vacuum is randomly placed at Location A") if Environment.locationCondition['A'] == 1: print ("Location A is Dirty. ") Environment.locationCondition['A'] = 0;

Subscribe to view the full document.

Score += 1 print ("Location A has been Cleaned. :D") if Environment.locationCondition['B'] == 1: print ("Location B is Dirty.") print ("Moving to Location B...") Score -= 1 Environment.locationCondition['B'] = 0; Score += 1 print ("Location B has been Cleaned :D.") else: if Environment.locationCondition['B'] == 1: print ("Location B is Dirty.")

Subscribe to view the full document.

• Spring '17

{[ snackBarMessage ]}

###### "Before using Course Hero my grade was at 78%. By the end of the semester my grade was at 90%. I could not have done it without all the class material I found."
— Christopher R., University of Rhode Island '15, Course Hero Intern

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern