Exemple #1
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);
            }
        }