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);
            }
Пример #2
0
        public override EnvironmentState executeAction(Agent agent, Action a)
        {
            if (!a.isNoOp())
            {
                MoveToAction act = (MoveToAction)a;

                string currLoc  = getAgentLocation(agent);
                double distance = map.getDistance(currLoc, act.getToLocation());
                if (distance != null)
                {
                    double currTD = getAgentTravelDistance(agent);
                    state.setAgentLocationAndTravelDistance(agent,
                                                            act.getToLocation(), currTD + distance);
                }
            }
            return(state);
        }