예제 #1
0
        public bool HasPlanAnt(Location ant, params PlanType[] plans)
        {
            foreach (var plan in plans)
            {
                switch (plan)
                {
                case PlanType.Move:
                    if (MovePlans.Exists(x => x.Ant.EqualTo(ant)))
                    {
                        return(true);
                    }
                    break;

                case PlanType.Attack:
                    if (AttackPlans.Exists(x => x.Ant.EqualTo(ant)))
                    {
                        return(true);
                    }
                    break;

                case PlanType.Food:
                    if (FoodPlans.Exists(x => x.Ant.EqualTo(ant)))
                    {
                        return(true);
                    }
                    break;

                case PlanType.Hill:
                    if (FoodPlans.Exists(x => x.Ant.EqualTo(ant)))
                    {
                        return(true);
                    }
                    break;

                case PlanType.NewBorn:
                    if (NewBornPlans.Exists(x => x.Ant.EqualTo(ant)))
                    {
                        return(true);
                    }
                    break;

                case PlanType.Explore:
                    if (ExplorePlans.Exists(x => x.Ant.EqualTo(ant)))
                    {
                        return(true);
                    }
                    break;
                }
            }
            return(false);
        }
예제 #2
0
        public bool HasPlanDest(Location dest, params PlanType[] plans)
        {
            foreach (var plan in plans)
            {
                switch (plan)
                {
                case PlanType.Move:
                    if (MovePlans.Exists(x => x.Dest.EqualTo(dest)))
                    {
                        return(true);
                    }
                    break;

                case PlanType.Attack:
                    if (AttackPlans.Exists(x => x.NextStep.EqualTo(dest)))
                    {
                        return(true);
                    }
                    break;

                case PlanType.Food:
                    if (FoodPlans.Exists(x => x.GetFinalMoveLoc().EqualTo(dest)))
                    {
                        return(true);
                    }
                    break;

                case PlanType.Hill:
                    if (FoodPlans.Exists(x => x.GetFinalMoveLoc().EqualTo(dest)))
                    {
                        return(true);
                    }
                    break;

                case PlanType.NewBorn:
                    if (NewBornPlans.Exists(x => x.GetFinalMoveLoc().EqualTo(dest)))
                    {
                        return(true);
                    }
                    break;

                case PlanType.Explore:
                    if (ExplorePlans.Exists(x => x.GetFinalMoveLoc().EqualTo(dest)))
                    {
                        return(true);
                    }
                    break;
                }
            }
            return(false);
        }
예제 #3
0
        public bool HasPlanAnt(Location ant)
        {
            bool food = FoodPlans.Exists(x => x.Ant.EqualTo(ant));

            if (food)
            {
                return(true);
            }

            bool move = MovePlans.Exists(x => x.Ant.EqualTo(ant));

            if (move)
            {
                return(true);
            }

            bool attack = AttackPlans.Exists(x => x.Ant.EqualTo(ant));

            if (attack)
            {
                return(true);
            }

            var born = NewBornPlans.Exists(x => x.Ant.EqualTo(ant));

            if (born)
            {
                return(true);
            }

            var exp = ExplorePlans.Exists(x => x.Ant.EqualTo(ant));

            if (exp)
            {
                return(true);
            }

            // has plan
            return(false);
        }