Inheritance: AIMA.Core.Agent.Impl.DynamicAction
Beispiel #1
0
            public System.Object result(System.Object s, Action a)
            {
                if (a is MoveToAction)
                {
                    MoveToAction mta = (MoveToAction)a;

                    return(mta.getToLocation());
                }

                // The Action is not understood or is a NoOp
                // the result will be the current state.
                return(s);
            }
Beispiel #2
0
        public override EnvironmentState executeAction(IAgent agent, Action a)
        {
            if (!a.isNoOp())
            {
                MoveToAction act = (MoveToAction)a;

                System.String currLoc  = getAgentLocation(agent);
                System.Double distance = aMap.getDistance(currLoc, act.getToLocation());
                if (distance != null)
                {
                    double currTD = getAgentTravelDistance(agent);
                    state.setAgentLocationAndTravelDistance(agent, act
                                                            .getToLocation(), currTD + distance);
                }
            }

            return(state);
        }