//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////// to look again ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // the definition of the plans // Plan Plan2_SatisfyHungry : // // // Animal( _Agent, Plan ):: [Animal : _Agent] <-actor-[Plan2_SatisfyHungry] -intensityOf-> [Hungry = _Level] :- Animal( _Agent, Procedure ):: [Animal : _Agent] <-actor- [PerceptionOf]- -id-> [Name = "Neigberhood"], -obj-> [Agent = _OtherAgent], -locatedIn-> [Position = _OtherAgentPosition], Animal( _Agent, Procedure ):: [Animal : _Agent] <-actor- [Trajectory]- -id-> [Name = "Final"], -locatedIn-> [CurrentPosition = _CurrentPosition], -to-> [TargetPosition = _AgentPosition], StartDiscussion(). //Animal( _Agent, Plan ):: [Animal : _Agent] <-actor- [Plan2_SatisfyHungry] -intensityOf-> [Hungry = _Level] :- // getFriendAnimalKnowledge( _Agent, _NameTrajectory), // getTrajectory( _Object, _Trajectory, _NameTrajectory ), // ReturnFirstElementOf( _Trajectory, _CurrentPosition), // Animal( x, Procedure ):: [Animal : x] <-actor- [Trajectory]- // -trajectoryId-> [Name = _NameTrajectory], // -locatedIn-> [CurrentPosition = _CurrentPosition], // -to-> [TargetPosition = _NextPosition], // moveToEndOfTraject( x, _NameTrajectory, _Level ). ////////////////////////////////////////////////////////////////-----------------description of the perception rule------------------///////////////////////////////////////////// // the case below is used if a possible friend agent of an the protagonist agent, who's looking for a friend, is his neigberhood // the perception of an animal Animal( _Agent, Procedure ):: [Animal : _Agent] <-actor- [PerceptionOf]- -id-> [Name = "Neigberhood"], -obj-> [Agent = _OtherAgent], -LocatedIn-> [Position = _OtherAgentPosition] :- getAnimalPerception( _Agent, _Ray ), getPossibleFriendOfAgentInNeiberhood( _Agent, _Ray, _AgentPosition, _Food, _OtherAgentPosition ), fullfilAnimalKnowledge( x, Knowledge):: [Object = _Food] -locatedIn-> [Position = _FoodPosition],!.