1/* * module * 
    2% This is a *very* simple example of an agent for
    3% the predator example world.
    4%
    5% eg.predator.pl
    6% July 8, 1996
    7% John Eikenberry
    8%
    9% Dec 13, 2035
   10% Douglas Miles
   11%
   12*/
   13
   14% Declare the module name and the exported (public) predicates.
   15:-swi_module(mobPredator,[]).   16
   17% Predicates asserted during run.
   18% :- dynamic memory/2.
   19
   20% Possible agent actions.
   21:- include(prologmud(mud_header)).   22% :- register_module_type (planning).
   23
   24
   25tCol(mobPredator).
   26world_agent_plan(_World,Agent,Act):-
   27   isa(Agent,mobPredator),
   28   predator_idea(Agent,Act).
   29
   30predator_idea(Agent,actEat(Corpse)) :-
   31	mudEnergy(Agent,Charge),
   32	Charge < 100,
   33	mudPossess(Agent, List),                
   34	obj_memb(Corpse,List),
   35        isa(Corpse,tCorpse).
   36predator_idea(Agent,actTake(What)) :-
   37	mudNearBody(Agent,What),
   38	isa(What,tCorpse).
   39predator_idea(Agent,actMove(Dir)) :-
   40	mudGetPrecepts(Agent,List),
   41	list_object_dir_sensed(_,List,iCorpseFn(_),Dir).
   42predator_idea(Agent,actAttack(Dir)) :-
   43	mudNearReach(Agent,List),
   44	list_object_dir_near(List,mobPrey,Dir).
   45
   46% find something near and itnersting and go to it.. or find a dirrection and go that way.. or sit 
   47
   48predator_idea(Agent,actMove(Dir)) :-
   49	mudGetPrecepts(Agent,List),
   50	list_object_dir_sensed(_,List,mobPrey,Dir).
   51
   52predator_idea(Agent,Act) :- 
   53      move_or_sit_memory_idea(Agent,Act,[tNut]).
   54
   55
   56:- include(prologmud(mud_footer)).