Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- aXiom(doing, print_(Agent, Msg)) -->
- h(descended, Agent, Here),
- queue_local_event(msg_from(Agent, Msg), [Here]).
- % ==============
- % WALK WEST
- % ==============
- aXiom(_, status_msg(_Begin,_End)) --> [].
- aXiom(doing, goto_dir(Agent, Walk, ExitName)) --> % go n/s/e/w/u/d/in/out
- must_act(status_msg(vBegin,goto_dir(Agent, Walk, ExitName))),
- dmust(from_loc(Agent, Here)),
- dmust(h(exit(ExitName), Here, _There)),
- %unless(h(exit(ExitName), Here, There), failure_msg(['Can\'t go ',ExitName,' way from', Here])),
- aXiom(doing, leaving(Agent, Here, Walk, ExitName)),
- must_act(status_msg(vDone,goto_dir(Agent, Walk, ExitName))).
- aXiom(_, leaving(Agent, Here, Walk, ExitName)) -->
- %member(At, [*, to, at, through, thru]),
- h(exit(ExitName), Here, There),
- aXiom(_, terminates(h(_, Agent, Here))),
- queue_local_event( leaving(Agent, Here, Walk, ExitName), [Here]),
- % queue_local_event( msg([cap(subj(Agent)), leaves, Here, ing(Walk), to, the, ExitName]), [Here]).
- dmust(aXiom(doing, arriving(Agent, There, Walk, reverse(ExitName)))).
- aXiom(_, terminates(h(Prep, Object, Here))) -->
- %ignore(sg(declared(h(Prep, Object, Here)))),
- undeclare(h(Prep, Object, Here)).
- aXiom(_, arriving(Agent, Here, Walk, ReverseDir)) -->
- queue_local_event( arriving(Agent, Here, Walk, ReverseDir), [Here]),
- %sg(default_rel(PrepIn, Here)), {atom(PrepIn)},
- {PrepIn = in},
- % [cap(subj(Agent)), arrives, PrepIn, Here, ing(Walk), from, the, ReverseDir]
- dmust(aXiom(_, initiates(h(PrepIn, Agent, Here)))),
- dmust(add_look(Agent)).
- aXiom(_, initiates(h(Prep, Object, Dest))) -->
- declare(h(Prep, Object, Dest)).
- % ==============
- % WALK TABLE
- % ==============
- aXiom(doing, goto_obj(Agent, Walk, Object)) -->
- has_rel(At, Object),
- aXiom(doing, goto_prep_obj(Agent, Walk, At, Object)).
- % ==============
- % WALK ON TABLE
- % ==============
- aXiom(doing, goto_prep_obj(Agent, Walk, At, Object)) -->
- touchable(Agent, Object),
- has_rel(At, Object),
- from_loc(Agent, Here),
- open_traverse(Object, Here),
- \+ is_status(Object, open, f),
- aXiom(doing, entering(Agent, Here, Walk, At, Object)).
- aXiom(doing, entering(Agent, Walk, Here, At, Object)) -->
- moveto(Agent, At, Object, [Here],
- [subj(Agent), person(Walk, es(Walk)), At, the, Object, .]),
- add_look(Agent).
- % ==============
- % GOTO PANTRY
- % ==============
- aXiom(doing, goto_loc(Agent, _Walk, There)) --> % go some room
- has_rel(exit(_), There),
- aXiom(doing, make_true(Agent, h(in, Agent, There))).
- aXiom(doing, make_true(Doer, h(in, Agent, There))) --> % go in (adjacent) room
- {Doer==Agent},
- has_rel(exit(_), There),
- from_loc(Agent, Here),
- getprop(Agent, memories(Memory)),
- agent_thought_model(Agent, ModelData, Memory),
- find_path(Here, There, Route, ModelData), !,
- aXiom(doing, follow_plan(Agent, goto_loc(Agent, walk, There), Route)).
- aXiom(doing, follow_plan(Agent, Name, [Step|Route])) -->
- aXiom(doing, follow_step(Agent, Name, Step)),
- aXiom(doing, follow_plan(Agent, Name, Route)).
- aXiom(doing, follow_step(Agent, Name, Step)) -->
- dbug(follow_step(Agent, Name, Step)),
- must_act(Step).
- % sim(verb(args...), preconds, effects)
- % Agent is substituted for Agent.
- % preconds are in the implied context of a State.
- % In Inform, the following are implied context:
- % actor, action, noun, second
- % Need:
- % actor/agent, verb/action, direct-object/obj1, indirect-object/obj2,
- % preposition-introducing-obj2
- %sim(put(Obj1, Obj2),
- % ( h(descended, Thing, Agent),
- % can_sense(Agent, Sense, Agent, Where),
- % has_rel(Relation, Where),
- % h(descended, Agent, Here)),
- % moveto(Thing, Relation, Where, [Here],
- % [cap(subj(Agent)), person('put the', 'puts a'),
- % Thing, Relation, the, Where, '.'])).
- aXiom(doing, does_put(Agent, Put, Thing1, At, Thing2)) -->
- from_loc(Agent, Here),
- % moveto(Thing1, held_by, Recipient, [Here], [cap(subj(Agent)), person([give, Recipient, the], 'gives you a'), Thing, '.'],
- moveto(Thing1, At, Thing2, [Here],
- [cap(subj(Agent)), person(Put, es(Put)), Thing1, At, Thing2, '.']).
- aXiom(doing, take(Agent, Thing)) -->
- % [silent(subj(Agent)), person('Taken.', [cap(Doer), 'grabs the', Thing, '.'])]
- required(touchable(Agent, Thing)),
- aXiom(doing, does_put(Agent, take, Thing, held_by, Agent)).
- aXiom(doing, drop(Agent, Thing)) -->
- touchable(Agent, Thing),
- h(At, Agent, Here),
- % has_rel(At, Here),
- aXiom(doing, does_put(Agent, drop, Thing, At, Here)).
- aXiom(doing, put(Agent, Thing1, Relation, Thing2)) -->
- has_rel(Relation, Thing2),
- (Relation \= in ; \+ is_closed(Thing2)),
- touchable(Agent, Thing2), % what if "under" an "untouchable" thing?
- % OK, put it
- must_act( does_put(Agent, put, Thing1, Relation, Thing2)).
- aXiom(doing, give(Agent, Thing, Recipient)) -->
- has_rel(held_by, Recipient),
- touchable(Agent, Thing),
- touchable(Recipient, Agent),
- % OK, give it
- must_act( does_put(Agent, give, Thing, held_by, Recipient)).
- % throw ball up
- aXiom(doing, throw_dir(Agent, Thing, ExitName)) -->
- h(AtHere, Agent, Here),
- (h(exit(ExitName), Here, There) -> has_rel(AtThere, There) ; (AtHere = AtThere, Here = There)),
- aXiom(doing, throwing(Agent, Thing, AtThere, There)).
- % throw ball at catcher
- aXiom(doing, throw_at(Agent, Thing, Target)) -->
- % h(At, Agent, Here),
- has_rel(AtTarget, Target),
- aXiom(doing, throwing(Agent, Thing, AtTarget, Target)).
- % throw ball over homeplate
- aXiom(doing, throw_prep_obj(Agent, Thing, ONTO, Target)) -->
- has_rel(ONTO, Target),
- %h(At, Agent, Here),
- aXiom(doing, throwing(Agent, Thing, ONTO, Target)).
- % is throwing the ball...
- aXiom(doing, throwing(Agent, Thing, At, Target)) -->
- touchable(Agent, Thing),
- can_sense(Agent, see, Target),
- aXiom(doing, thrown(Agent, Thing, At, Target)).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement