Exemplo n.º 1
0
# -*- coding: utf-8 -*-
import gps2

banana_ops = [
    gps2.operator('clime-on-chiar', 
                  ('chair-at-middle-room', 'at-middle-room', 'on-floor'),
                  ('at-bananas', 'on-char'),
                  ('at-middle-room', 'on-floor')),
    gps2.operator('push-chair-from-door-to-middle-room',
                  ('chair-at-door', 'at-door'),
                  ('chair-at-middle-room', 'at-middle-room'),
                  ('chair-at-door', 'at-door')),
    gps2.operator('walk-from-door-to-middle-room',
                  ('at-door', 'on-floor'),
                  ('at-middle-room',),
                  ('at-door',)),
    gps2.operator('grasp-bananas',
                  ('at-bananas', 'empty-handed'),
                  ('has-bananas',),
                  ('empty-handed',)),
    gps2.operator('drop-ball',
                  ('has-ball',),
                  ('empty-handed',),
                  ('has-ball',)),
    gps2.operator('eat-bananas',
                  ('has-bananas',),
                  ('empty-handed', 'not-hungry'),
                  ('has-bananas', 'hungry'))
    ]
    
Exemplo n.º 2
0
def make_maze_operator(here, there):
    op = gps2.operator('move from %s to %s' % (here, there),
                       (('at %s' % here),),
                       (('at %s' % there),),
                       (('at %s' % here),))
    return op
Exemplo n.º 3
0
def move_op(obj, dst, src):
    action = "move " + obj + " from " + dst + " to " + src
    preconds = [ on('space', obj), on('space', src), on(obj, dst)]
    add_list = move_ons(obj, dst, src)
    del_list = move_ons(obj, src, dst)
    return gps2.operator(action, preconds, add_list, del_list)