git @ Cat's Eye Technologies The-Swallows / aeef63f
Eliminate one case of mind-reading, using beliefs-of-others'-beliefs instead. Cat's Eye Technologies 9 years ago
1 changed file(s) with 17 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
44 Animate, ProperMixin, MasculineMixin, FeminineMixin,
55 Topic,
66 GreetTopic, SpeechTopic, QuestionTopic,
7 Goal,
7 Belief, ItemLocation, Goal,
88 )
99
1010 # TODO
379379
380380 # this is its own method for indentation reasons
381381 def discuss(self, other, self_memory):
382 # in general, characters should not be able to read each other's
383 # minds. however, it's convenient here. besides, their face would
384 # be pretty easy to read in this circumstance.
385 other_memory = other.recall_location(self_memory.subject)
386 if self_memory and not other_memory:
382 assert self_memory
383 assert isinstance(self_memory, Belief)
384 # for now,
385 # self_memory is an ItemLocation belief about something on our mind
386 assert isinstance(self_memory, ItemLocation)
387
388 # what do I believe the other believes about it?
389 other_beliefs = self.believed_beliefs_of(other)
390 other_memory = other_beliefs.get(self_memory)
391
392 if not other_memory:
387393 self.question(other,
388394 "'Did you know there's <indef-3> in <4>?' asked <1>",
389395 [self, other, self_memory.subject, self_memory.location],
390396 subject=self_memory.subject)
397 # well now they know what we think, anyway
398 other.believed_beliefs_of(self).add(self_memory)
391399 return
392 if self_memory and other_memory:
400 else:
393401 choice = random.randint(0, 2)
394402 if choice == 0:
395403 self.question(other, "'Do you think we should do something about <3>?' asked <1>",
396404 [self, other, self_memory.subject])
405 other.believed_beliefs_of(self).add(self_memory)
397406 if choice == 1:
398407 self.speak_to(other, "'I think we should do something about <3>, <2>,' said <1>",
399408 [self, other, self_memory.subject])
409 other.believed_beliefs_of(self).add(self_memory)
400410 if choice == 2:
401411 if self.nerves == 'calm':
402412 self.decide_what_to_do_about(other, self_memory.subject)