Beispiel #1
0
    // The recursive higher-order observation method as described in the thesis.
    // It has a height limiter to specify the desired max order of observation.
    public void UpdateToM(Subject s, Beliefs b, HashSet <Location> fov, int height)
    {
        if (height == 0 || b.Sees.Agents.Count == 0)
        {
            return;
        }

        foreach (KeyValuePair <char, Subject> kvp in b.Sees.Agents)
        {
            HashSet <Location> intersectFov = FOV.GetSharedFov(kvp.Value, s);

            VisionPercept vp = Sight.Perceive(kvp.Key, intersectFov);
            AudioPercept  ap = Hearing.Perceive(kvp.Key, kvp.Value.Location);

            if (!b.ToM.ContainsKey(kvp.Key))
            {
                b.ToM.Add(kvp.Key, new Beliefs());
            }

            b.ToM[kvp.Key].Update(vp);
            b.ToM[kvp.Key].Update(ap);

            UpdateToM(kvp.Value, b.ToM[kvp.Key], intersectFov, height - 1);
        }
    }
Beispiel #2
0
    // 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
        });
    }