Example #1
0
def smell_of(agent, tokens, _):
    'to percieve something by the sense of smell'
    return Sense('smell',
                 agent,
                 template='[agent/s] [smell/v] [direct/o]',
                 direct=tokens[1],
                 modality='smell')
Example #2
0
def taste(agent, tokens, _):
    'to percieve by the sense of taste, by sampling a small bit'
    return Sense('taste',
                 agent,
                 template='[agent/s] [taste/v] [direct/o]',
                 direct=tokens[1],
                 modality='taste')
Example #3
0
def look_at(agent, tokens, _):
    'to inspect something carefully, visually'
    return Sense('examine',
                 agent,
                 template='[agent/s] [look/v] at [direct/o]',
                 modality='sight',
                 direct=tokens[1])
Example #4
0
def listen_to(agent, tokens, _):
    'to give close attention to something specified with the purpose of hearing'
    return Sense('hear',
                 agent,
                 template='[agent/s] [listen/v] to [direct/o]',
                 direct=tokens[1],
                 modality='hearing')
Example #5
0
                         '@robber',
                         template='[agent/s] [leave/v] the street',
                         direct='@robber',
                         direction='in')
WAVE = Behave('wave',
              '@teller',
              target='@robber',
              template='[agent/s] [wave/v] to [direct/o]')
BRANDISH = Behave('brandish',
                  '@robber',
                  target='@teller',
                  indirect='@fake_gun',
                  template='[agent/s] [brandish/v] [indirect/o] at [direct/o]')
LAUGH = Behave('laugh', '@teller')
WAKE = Behave('wake', '@guard')
SEE_ROBBER = Sense('see', '@guard', direct='@robber', modality='sight')
GUARD_TO_LOBBY = Behave('leave',
                        '@guard',
                        template='[agent/s] [leave/v] the guard post',
                        direct='@guard',
                        direction='out')
BAG_FAKE = Configure('put',
                     '@teller',
                     direct='@fake_money',
                     new=('in', '@bag'),
                     template='[agent/s] [put/v] [direct/o] in [@bag/o]')
TURN = Behave('turn',
              '@robber',
              target='@guard',
              template='[agent/s] [turn/v] to [direct/o]')
SHOOT_1 = Behave('shoot',
Example #6
0
def touch(agent, tokens, _):
    'to come in contact with; to extend the hand so as to reach and feel'
    return Sense('touch', agent, direct=tokens[1], modality='touch')
Example #7
0
        'narratee': '@person',
        'known_directions': True
    }
}

ARRIVE = Behave('arrive',
                '@person',
                template="""
                hurrying through the rainswept November night, [@person/s] 
                [are/v] glad to see the bright lights of the Opera House""",
                indirect='@foyer')
ARRIVE.after = """it [is/1/v] surprising that there [are/not/2/v] more people 
               about but, hey, what should [@person/s] expect in a cheap demo 
               game?"""

LOOK_AROUND = Sense('see', '@person', direct='@foyer', modality='sight')

initial_actions = [ARRIVE, LOOK_AROUND]


class ScrawledMessage(Thing):
    def __init__(self, tag, **keywords):
        self.intact = True
        Thing.__init__(self, tag, **keywords)

    def react(self, world, basis):
        actions = []
        if (basis.sense and basis.direct == '@message'
                and basis.modality == 'sight'):
            sigh = Behave('sigh', basis.agent)
            sigh.final = True
Example #8
0
SHINE = Behave('shine', '@cosmos', direct='@visitor')
SHINE.after = """

[now] they [drive/2/v] cars, seeking flatpacks across the sprawl

once they were supposed to cluster [here]

[@visitor/s] [arrive/ed/v], visitor to this place where [@visitor/s] briefly 
lived years ago, where [@visitor/s] knew spaces and faces now almost forgotten

there is one [here] less lost to you than the others, though, and it [is/1/v] 
right [here] in this plaza, about [now], that [@visitor/s] [are/v] to meet him

somewhere right around [here]"""

SEE_PLAZA = Sense('see', '@visitor', direct='@plaza_center', modality='sight')

initial_actions = [SHINE, SEE_PLAZA]


class Distance_Filter:
    'Increases narrative distance by changing to less immediate styles.'

    def __init__(self, how_far):
        self.suffixes = [
            ', apparently ', ', evidently', ', or so it seemed',
            ', if memory serves', ', perhaps'
        ]
        self.prefixes = [
            'it seemed that', 'it appeared that', 'it looked like',
            'it was as if', 'no doubt,'
Example #9
0
discourse = {
    'metadata': {
        'title': 'Artmaking',
        'headline': 'A very simple example',
        'people': [('by', 'Nick Montfort')],
        'prologue': 'Settle for nothing less than an artistic breakthrough.'
    },
    'spin': {
        'commanded': '@artist',
        'focalizer': '@artist',
        'narratee': '@artist'
    }
}

initial_actions = [
    Sense('ogle', '@artist', direct='@studio', modality='sight')
]


class Art(Thing):
    '@sculpture is the only instance.'

    def react(self, world, basis):
        'Win the game when smashed.'
        actions = []
        if (basis.verb in ['kick', 'strike'] and basis.direct == str(self)):
            damage = Modify('puncture',
                            basis.agent,
                            direct=str(self),
                            feature='intact',
                            new=False)