예제 #1
0
        private ActionType actionToStopFire(TravelWorld currWorld)
        {
            if (_firePath == null)
            {
                _firePath = findFirePath(currWorld);
            }

            if (_firePath != null && _firePath.Count > 0)
            {
                int nextPlace = _firePath.TakeNextStep();
                return(new ActionType(world => { return drive(world, nextPlace); }));
            }
            else
            {
                return(noOpertion);
            }
        }
예제 #2
0
        private ActionType actionToFindWater(TravelWorld currWorld)
        {
            if (currWorld.HaveWater(CurrentLocation))
            {
                return(new ActionType(world => { return pickupWater(world); }));
            }

            if (_waterPath == null || _waterPath.Count() == 0 || currWorld.isPathClear(_waterPath))
            {
                _waterPath = findWaterPath(currWorld);
            }


            if (_waterPath != null && _waterPath.Count > 0)
            {
                int nextPlace = _waterPath.TakeNextStep();
                return(new ActionType(world => { return drive(world, nextPlace); }));
            }
            else
            {
                return(noOpertion);
            }
        }