Guest User

Untitled

a guest
Jul 16th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. class PoliceOfficer (Person):
  2. def __init__(self, name, jail):
  3. Person.__init__(self, name)
  4. self.__jail = jail
  5. self.set_restlessness(0.5)
  6. def arrest(self, person):
  7. if self.location == person.location:
  8. self.say(person.name + ", you are under arrest!")
  9. self.say("You have the right to remain silent, call methods, and mutate instance variables.")
  10. person.move(self.__jail)
  11. else:
  12. self.say(person.name + " is not here")
  13. def tick(self):
  14. for t in self.location.get_things():
  15. if (isinstance(t, Student) and (t.location == self.location) and (t.dressed == False)):
  16. self.say(t.name + ", you are under arrest!")
  17. self.say("You have the right to remain silent, call methods, and mutate instance variables.")
  18. t.move(self.__jail)
  19. else:
  20. Person.tick(self)
Add Comment
Please, Sign In to add comment