Exemplo n.º 1
0
        public override Queue <Location> ExtractPlan(Subject s, Intention i, Beliefs b, List <Location> path)
        {
            Queue <Location> plan = new Queue <Location>();
            Location         dest = new Location();

            HashSet <Location> fov = FOV.GetFov(b.Agents[i.ID].Direction, b.Agents[i.ID].Location);

            if (fov.Except(FOV.GetSharedFov(s, b.Agents[i.ID])).Count() > 0)
            {
                dest = Util.RandomElement(fov.Except(FOV.GetSharedFov(s, b.Agents[i.ID])).ToList(), s.Location);
            }
            else
            {
                dest = Util.RandomElement(fov.ToList(), s.Location);
            }

            FlankNode fNode = new FlankNode(null, dest, b.Agents[i.ID].Location)
            {
                CurLocation = new Location(s.Location),
                Obstacles   = new HashSet <Location>(b.Obstacles.Keys)
            };

            fNode.Obstacles.UnionWith(Util.GetDynamicObstacles(s.ID, s.Location, b));

            plan = Planner.Search(fNode);

            return(plan);
        }
Exemplo n.º 2
0
Arquivo: Agent.cs Projeto: s162995/CtC
    // The agent generates audio and vision percept from the locations
    // within the agent's field of view.
    protected List <IPercept> Perceive()
    {
        HashSet <Location> fov = FOV.GetFov(Direction, Location);

        VisionPercept p  = Sight.Perceive(ID, fov);
        AudioPercept  p2 = Hearing.Perceive(ID, Location);

        Piece.DisplayFeature(fov.ToList(), Feature.Vision);
        Piece.DisplayFeature(fov.Intersect(Manager.Board.Obstacles.Keys).ToList(), Feature.Obstacle);
        Piece.DisplayFeature(fov.Intersect(Manager.Board.Foods.Keys).ToList(), Feature.Food);

        return(new List <IPercept>()
        {
            p, p2
        });
    }