42 | 42 |
- active and passive participants
|
43 | 43 |
- active participants all must be present at the location
|
44 | 44 |
- passive participants need not be
|
|
45 |
(probably done by passing a number n: the first n
|
|
46 |
participants are to be considered active)
|
45 | 47 |
|
46 | 48 |
"""
|
47 | 49 |
self.phrase = phrase
|
|
78 | 80 |
def collect(self, event):
|
79 | 81 |
self.events.append(event)
|
80 | 82 |
|
|
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 |
|
81 | 96 |
|
82 | 97 |
# not really needed, as emit() does nothing if there is no collector
|
83 | 98 |
class Oblivion(EventCollector):
|
|
260 | 275 |
"""
|
261 | 276 |
|
262 | 277 |
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()
|
263 | 282 |
self.events = list(reversed(collector.events))
|
264 | 283 |
self.main_characters = main_characters
|
265 | 284 |
self.pov_index = 0
|
|
290 | 309 |
"""Returns how many sentences it produced.
|
291 | 310 |
|
292 | 311 |
"""
|
293 | |
if True: # debug
|
|
312 |
if False: # debug
|
294 | 313 |
print "%r in %s: %s" % (
|
295 | 314 |
[p.render([]) for p in event.participants],
|
296 | 315 |
event.location.render([]),
|