git @ Cat's Eye Technologies The-Swallows / d57cc53
Diction will get worse before it gets better. Add 'place_in'. Cat's Eye Technologies 11 years ago
1 changed file(s) with 42 addition(s) and 25 deletion(s). Raw diff Collapse all Expand all
2424 # would be nicer in Prolog.
2525 # DRAMATIC IRONY would be really nice, but hard to pull off.
2626 # "it was so nice" -- actually *have* memories of locations, and feelings
27 # (good/bad, 0 to 10 or something) about memories
27 # (good/bad, 0 to 10 or something) about memories
2828 # anxiety memory = the one they're most recently panicked about
2929 # memory of objects -> memory of hiding them somewhere
3030 # bullets for the revolver
236236 def threaten(self, other, phrase, participants=None, subject=None):
237237 self.address(other, ThreatTopic(self, subject=subject), phrase, participants)
238238
239 # self.location=None implies this is just an initial move
240 def move_to(self, location):
241 initial = (self.location is None)
242 if not initial:
243 for x in self.location.contents:
244 # otherwise we get "Bob saw Bob leave the room", eh?
245 if x is self:
246 continue
247 if x.animate():
248 x.emit("<1> saw <2> leave the room", [x, self])
239 def place_in(self, location):
240 # like move_to but quieter; for setting up scenes etc
241 if self.location is not None:
249242 self.location.contents.remove(self)
250243 self.location = location
251244 self.location.contents.append(self)
252 verb = pick(['went to', 'walked to', 'moved to'])
253 if initial:
254 verb = 'was in'
255 self.emit("<1> %s <2>" % verb, [self, self.location])
245 self.emit("<1> was in <2>", [self, self.location])
246 for x in self.location.contents:
247 if x == self:
248 continue
249 if x.notable():
250 self.emit("<1> saw <2>", [self, x])
251 self.memory[x.name] = Memory(x, self.location)
252
253
254 def move_to(self, location):
255 assert(location != self.location)
256 assert(location is not None)
257 for x in self.location.contents:
258 # otherwise we get "Bob saw Bob leave the room", eh?
259 if x is self:
260 continue
261 if x.animate():
262 x.emit("<1> saw <2> leave the room", [x, self])
263 if self.location is not None:
264 self.location.contents.remove(self)
265 self.location = location
266 self.location.contents.append(self)
267 self.emit("<1> went to <2>", [self, self.location])
256268 if random.randint(0, 10) == 0:
257269 self.emit("It was so nice being in <2> again",
258270 [self, self.location], excl=True)
273285 elif x.animate():
274286 other = x
275287 self.emit("<1> saw <2>", [self, other])
276 if not initial:
277 other.emit("<1> saw <2> walk into the room", [other, self])
288 other.emit("<1> saw <2> walk into the room", [other, self])
278289 self.memory[x.name] = Memory(x, self.location)
279290 self.greet(x, "'Hello, <2>,' said <1>")
280291 for y in other.contents:
397408 if choice == 0:
398409 self.question(other, "'Lovely weather we're having, isn't it?' asked <1>")
399410 if choice == 1:
400 self.speak_to(other, "'I was wondering where you were.' said <1>")
411 self.speak_to(other, "'I was wondering where you were,' said <1>")
401412 elif isinstance(topic, QuestionTopic):
402413 if topic.subject is not None:
403414 choice = random.randint(0, 1)
562573 ### main ###
563574
564575 friffery = False
565 debug = True
576 debug = False
566577
567578 print "Swallows and Sorrows (DRAFT)"
568579 print "============================"
584595 for paragraph in range(1, 30):
585596 alice.collector = alice_collector
586597 bob.collector = bob_collector
587 pov_actor = pick([alice, bob])
588 c = pov_actor.collector
598
599 # we could do this randomly...
600 #pov_actor = pick([alice, bob])
601 # but, we could also alternate. They ARE Alice and Bob, after all.
602 pov_actor = (alice, bob)[(paragraph - 1) % 2]
589603
590604 for actor in (alice, bob):
591605 if actor.location is None:
592 actor.move_to(pick(house))
593
594 while len(c.events) < 20:
606 actor.place_in(pick(house))
607 else:
608 self = actor
609 self.emit("<1> was in <2>", [self, self.location])
610
611 while len(pov_actor.collector.events) < 20:
595612 alice.live()
596613 bob.live()
597614
629646 print "- - - - -"
630647 print
631648 else:
632 for event in c.events:
649 for event in pov_actor.collector.events:
633650 sys.stdout.write(str(event) + " ")
634651 #sys.stdout.write("\n")
635652 print