Exemplo n.º 1
0
 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
         actions.append(sigh)
     return actions
Exemplo n.º 2
0
 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
         actions.append(sigh)
     return actions
Exemplo n.º 3
0
 def act(self, command_map, concept):
     actions = []
     if (self.distance == 0 and concept.ticks > 80 and
         str(concept.item['@visitor'].place(concept)) == '@plaza_center'):
         smile = Behave('smile', '@visitor')
         smile.final = True
         smile.before = """[@visitor/s] [turn/v] and [see/v] [@visitor's] 
                        friend"""
         actions.append(smile)
     return actions
Exemplo n.º 4
0
 def act(self, command_map, concept):
     actions = []
     if (self.distance == 0 and concept.ticks > 80 and str(
             concept.item['@visitor'].place(concept)) == '@plaza_center'):
         smile = Behave('smile', '@visitor')
         smile.final = True
         smile.before = """[@visitor/s] [turn/v] and [see/v] [@visitor's] 
                        friend"""
         actions.append(smile)
     return actions
Exemplo n.º 5
0
def wander(agent, _, __):
    'to ramble here and there without any certain course; to rove'
    return Behave(
        'wander',
        agent,
        template='[agent/s] [wander/v] around, staying in the same area',
        direct=agent)
Exemplo n.º 6
0
def drink_it_from(agent, tokens, _):
    'to swallow a specific liquid from a vessel or source'
    return Behave('drink',
                  agent,
                  template='[agent/s] [drink/v] [direct/o] from [indirect/o]',
                  direct=tokens[1],
                  indirect=tokens[2])
Exemplo n.º 7
0
def utter(agent, tokens, _):
    'to speak; to pronounce (to no one in particular)'
    said = ' '.join(tokens[1:])
    return Behave('say',
                  agent,
                  template='[agent/s] [say/v] [utterance]',
                  utterance=said)
Exemplo n.º 8
0
def touch_with(agent, tokens, _):
    'to come in contact with; to extend an object so as to reach'
    return Behave('touch',
                  agent,
                  template='[agent/s] [touch/v] [direct/o] with [indirect/o]',
                  direct=tokens[1],
                  indirect=tokens[2])
Exemplo n.º 9
0
def leave(agent, tokens, _):
    'to pass from one place to another on foot at a normal pace'
    return Behave('leave',
                  agent,
                  template='[agent/s] [head/v] [direction]',
                  direct=agent,
                  direction=tokens[1])
Exemplo n.º 10
0
def shake_at(agent, tokens, _):
    'to cause to move with quick or violent vibrations at something'
    return Behave('shake',
                  agent,
                  template='[agent/s] [shake/v] [indirect/o] at [direct/o]',
                  indirect=tokens[1],
                  target=tokens[2])
Exemplo n.º 11
0
def tell(agent, tokens, _):
    'to utter or recite to one or more people; to say'
    said = ' '.join(tokens[2:])
    return Behave('tell',
                  agent,
                  template='[agent/s] [say/v] [utterance] to [direct/o]',
                  utterance=said,
                  target=tokens[1])
Exemplo n.º 12
0
def strike_with(agent, tokens, _):
    'to touch or hit with force, with an instrument; to smite'
    return Behave('strike',
                  agent,
                  template='[agent/s] [strike/v] [direct/o] with [indirect/o]',
                  direct=tokens[1],
                  indirect=tokens[2],
                  force=0.4)
Exemplo n.º 13
0
def drink_from(agent, tokens, concept):
    'to swallow from a vessel or source'
    if len(concept.item[tokens[1]].children) > 0:
        (_, direct) = concept.item[tokens[1]].children[0]
    else:
        direct = '@cosmos'
    return Behave('drink',
                  agent,
                  template='[agent/s] [drink/v] from [indirect/o]',
                  direct=direct,
                  indirect=tokens[1])
Exemplo n.º 14
0
def strike(agent, tokens, _):
    'to touch or hit with force, with the hand; to smite'
    return Behave('strike', agent, direct=tokens[1], force=0.4)
Exemplo n.º 15
0
        ('SHINE', 'the sun [hit/1/v] the plaza')],

    'spin': {
        'focalizer': '@visitor',
        'commanded': '@visitor',
        'speed': 0.5,
        'time': 'during',
        'order': 'chronicle',
        'narratee': '@visitor',
        'narrator': None,
        'known_directions': False,
        'room_name_headings': False,
        'time_words': False,
        'dynamic': True}}

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')
Exemplo n.º 16
0
          '(hang|put|place) ACCESSIBLE (up )?(atop|on|onto) ACCESSIBLE',
          '(hang|put)( up)? ACCESSIBLE (atop|on|onto) ACCESSIBLE']},

    'action_templates': [
        ('PUT new_link=on new_parent=@hook',
         '[agent/s] [hang/v] [direct/o] up on [indirect/o]')],

    'spin': {
        'focalizer': '@person',
        'commanded': '@person',
        '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)
Exemplo n.º 17
0
def eat(agent, tokens, _):
    'to chew and swallow as food; to devour'
    return Behave('eat', agent, direct=tokens[1])
Exemplo n.º 18
0
def wave(agent, _, __):
    'to move the hands one way and the other'
    return Behave('wave', agent)
Exemplo n.º 19
0
def press(agent, tokens, _):
    'to exert pressure or force upon'
    return Behave('press', agent, direct=tokens[1])
Exemplo n.º 20
0
def kick(agent, tokens, _):
    'to strike, thrust, or hit violently with the foot'
    return Behave('kick', agent, direct=tokens[1], force=0.5)
Exemplo n.º 21
0
def freeze(agent, _, __):
    'to halt; to stop moving as if congealed by cold'
    return Behave('freeze', agent, template='[agent/s] [stand/v] very still')
Exemplo n.º 22
0
def wait(agent, _, __):
    'to remain idle'
    return Behave('wait', agent)
Exemplo n.º 23
0
def drink(agent, tokens, _):
    'to swallow a specific liquid, as, to drink water'
    return Behave('drink', agent, direct=tokens[1])
Exemplo n.º 24
0
            '(hang|put)( up)? ACCESSIBLE (atop|on|onto) ACCESSIBLE'
        ]
    },
    'action_templates': [('PUT new_link=on new_parent=@hook',
                          '[agent/s] [hang/v] [direct/o] up on [indirect/o]')],
    'spin': {
        'focalizer': '@person',
        'commanded': '@person',
        '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)
Exemplo n.º 25
0
def wave_at(agent, tokens, _):
    'to gesture at someone by moving the hands'
    return Behave('wave',
                  agent,
                  template='[agent/s] [wave/v] at [direct/o]',
                  target=tokens[1])
Exemplo n.º 26
0
def shake(agent, tokens, _):
    'to cause to move with quick or violent vibrations; to make to tremble'
    return Behave('shake',
                  agent,
                  template='[agent/s] [shake/v] [direct/o]',
                  direct=tokens[1])
Exemplo n.º 27
0
from curveship import can

discourse = {
    'metadata': {
        'title': 'The Simulated Bank Robbery'
    },
    'spin': {
        'commanded': '@robber',
        'focalizer': '@robber',
        'narratee': None,
        'time_words': False,
        'room_name_headings': False
    }
}

READ_SLIPS = Behave('read', '@teller', direct='@slips')
SNOOZE = Behave('snooze', '@guard', template='[agent/s] [snooze/ing/v]')
COUNT_SLIPS = Behave('count', '@teller', direct='@slips')
DON_MASK = Configure('wear',
                     '@robber',
                     direct='@mask',
                     new=('on', '@robber'),
                     template='[agent/s] [put/v] on [direct/o]')
TYPE = Behave('type', '@teller')
PLAY = Behave(
    'play',
    '@teller',
    template="[agent/s] [play/v] Solitaire a bit on [agent's] computer")
ROBBER_TO_LOBBY = Behave('leave',
                         '@robber',
                         template='[agent/s] [leave/v] the street',
Exemplo n.º 28
0
    'spin': {
        'focalizer': '@visitor',
        'commanded': '@visitor',
        'speed': 0.5,
        'time': 'during',
        'order': 'chronicle',
        'narratee': '@visitor',
        'narrator': None,
        'known_directions': False,
        'room_name_headings': False,
        'time_words': False,
        'dynamic': True
    }
}

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')