Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PoliceOfficer (Person):
- def __init__(self, name, jail):
- Person.__init__(self, name)
- self.__jail = jail
- self.set_restlessness(0.5)
- def arrest(self, person):
- if self.location == person.location:
- self.say(person.name + ", you are under arrest!")
- self.say("You have the right to remain silent, call methods, and mutate instance variables.")
- person.move(self.__jail)
- else:
- self.say(person.name + " is not here")
- def tick(self):
- for t in self.location.get_things():
- if (isinstance(t, Student) and (t.location == self.location) and (t.dressed == False)):
- self.say(t.name + ", you are under arrest!")
- self.say("You have the right to remain silent, call methods, and mutate instance variables.")
- t.move(self.__jail)
- else:
- Person.tick(self)
Add Comment
Please, Sign In to add comment