git @ Cat's Eye Technologies The-Swallows / b0db2c8
Refactor decide_what_to_do_about() to be independent of dead bodies. Cat's Eye Technologies 11 years ago
1 changed file(s) with 20 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
338338 # this should really be *derived* from having a recent memory
339339 # of seeing a dead body in the bathroom. but for now,
340340 self.nerves = 'calm'
341 # this, too, should be more general and sophisticated.
341 # this, too, should be more sophisticated.
342342 # it is neither a memory, nor a belief, but a judgment, and
343343 # eventually possibly a goal.
344 self.what_to_do_about_the_body = None
345 self.other_decision_about_the_body = None
344 # hash maps Actors to strings
345 self.what_to_do_about = {}
346 self.other_decision_about = {}
346347
347348 def animate(self):
348349 return True
780781 # this should probably be affected by whether this
781782 # character has, oh, i don't know, put the other at
782783 # gunpoint yet, or not, or something
783 if self.what_to_do_about_the_body is None:
784 if self.what_to_do_about.get(thing) is None:
784785 if random.randint(0, 1) == 0:
785 self.what_to_do_about_the_body = 'call'
786 self.what_to_do_about[thing] = 'call'
786787 else:
787 self.what_to_do_about_the_body = 'dispose'
788 if self.other_decision_about_the_body == self.what_to_do_about_the_body:
789 if self.what_to_do_about_the_body == 'call':
788 self.what_to_do_about[thing] = 'dispose'
789 if self.other_decision_about.get(thing, None) == self.what_to_do_about[thing]:
790 if self.what_to_do_about[thing] == 'call':
790791 self.question(other, "'So we're agreed then, we should call the police?' asked <1>",
791792 [self, other, thing])
792793 # the other party might not've been aware that they agree
793 other.other_decision_about_the_body = \
794 self.what_to_do_about_the_body
795 elif self.what_to_do_about_the_body == 'dispose':
794 other.other_decision_about[thing] = \
795 self.what_to_do_about[thing]
796 elif self.what_to_do_about[thing] == 'dispose':
796797 self.question(other, "'So we're agreed then, we should try to dispose of <3>?' asked <1>",
797798 [self, other, thing])
798 other.other_decision_about_the_body = \
799 self.what_to_do_about_the_body
799 other.other_decision_about[thing] = \
800 self.what_to_do_about[thing]
800801 else:
801802 raise ValueError("damn")
802 elif self.what_to_do_about_the_body == 'call':
803 elif self.what_to_do_about[thing] == 'call':
803804 self.speak_to(other, "'I really think we should call the police, <2>,' said <1>",
804805 [self, other, thing])
805 other.other_decision_about_the_body = \
806 self.what_to_do_about_the_body
807 elif self.what_to_do_about_the_body == 'dispose':
806 other.other_decision_about[thing] = \
807 self.what_to_do_about[thing]
808 elif self.what_to_do_about[thing] == 'dispose':
808809 self.speak_to(other, "'I think we should try to dispose of <3>, <2>,' said <1>",
809810 [self, other, thing])
810 other.other_decision_about_the_body = \
811 self.what_to_do_about_the_body
811 other.other_decision_about[thing] = \
812 self.what_to_do_about[thing]
812813 else:
813814 raise ValueError("damn")
814815