git @ Cat's Eye Technologies The-Swallows / a1fc8e0
Deduping (temporarily, until we fix it at the source.) Cat's Eye Technologies 11 years ago
2 changed file(s) with 21 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
2020 characters=(alice, bob),
2121 setting=house,
2222 title="Title TBD (Book Four of _The Swallows_ series)",
23 debug=True,
23 #debug=True,
2424 #chapters=1,
2525 )
2626 publisher.publish()
4242 - active and passive participants
4343 - active participants all must be present at the location
4444 - passive participants need not be
45 (probably done by passing a number n: the first n
46 participants are to be considered active)
4547
4648 """
4749 self.phrase = phrase
7880 def collect(self, event):
7981 self.events.append(event)
8082
83 def dedup(self):
84 """Modifies the sequence of events so that the same event
85 does not occur multiple times in a row.
86
87 """
88 if len(self.events) <= 1:
89 return
90 events = [self.events[0]]
91 for event in self.events[1:]:
92 if str(event) != str(events[-1]):
93 events.append(event)
94 self.events = events
95
8196
8297 # not really needed, as emit() does nothing if there is no collector
8398 class Oblivion(EventCollector):
260275 """
261276
262277 def __init__(self, collector, main_characters):
278 # This dedup'ing is temporary.
279 # Eventually, we will dedup at the source (the Actors which
280 # are currently producing redundant events.)
281 collector.dedup()
263282 self.events = list(reversed(collector.events))
264283 self.main_characters = main_characters
265284 self.pov_index = 0
290309 """Returns how many sentences it produced.
291310
292311 """
293 if True: # debug
312 if False: # debug
294313 print "%r in %s: %s" % (
295314 [p.render([]) for p in event.participants],
296315 event.location.render([]),