Ejemplo n.º 1
0
        protected override void Type(Entity e)
        {
            Morgs morgs = e as Morgs;

            if (morgs != null)
            {
                var type = morgs.Name;
                switch (type)
                {
                case "A":
                    Console.WriteLine("cyborg morg type is:" + morgs.Name);
                    break;

                case "B":
                    Console.WriteLine("cyborg morg type is:" + morgs.Name);
                    break;

                case "C":
                    Console.WriteLine("cyborg morg type is:" + morgs.Name);
                    break;

                case "D":
                    Console.WriteLine("cyborg morg type is:" + morgs.Name);
                    break;

                default:
                    Console.WriteLine("cyborg morg type is:" + morgs.Name);
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        protected override void Hunt(Entity e)
        {
            Morgs morgs = e as Morgs;

            if (morgs != null)
            {
                var hunting = morgs.FeedingBehavior;
                switch (hunting)
                {
                case "Absorbs B C":
                    Console.WriteLine(morgs.Name + " have absorbed Type B and C");
                    break;

                case "Envelops A":
                    Console.WriteLine(morgs.Name + " have envolped Type A");
                    break;

                case "Envelops A B":
                    Console.WriteLine(morgs.Name + " have enveloped Type A and B");
                    break;

                case "Absorbs C":
                    Console.WriteLine(morgs.Name + " have abosorbed Type C");
                    break;

                default:
                    Console.WriteLine(morgs.Name + " is sleeping!!!");
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        protected override void Type(Entity e)
        {
            Morgs morgs = e as Morgs;

            if (morgs != null)
            {
                var type = morgs.Name;
                switch (type)
                {
                case "N":
                    Console.WriteLine("organic morg type is:" + morgs.Name);
                    break;

                case "K":
                    Console.WriteLine("organic morg type is:" + morgs.Name);
                    break;

                case "F":
                    Console.WriteLine("organic morg type is:" + morgs.Name);
                    break;

                case "G":
                    Console.WriteLine("organic morg type is:" + morgs.Name);
                    break;

                default:
                    Console.WriteLine("organic morg type is:" + morgs.Name);
                    break;
                }
            }
        }
Ejemplo n.º 4
0
        protected override bool CloseEnough(Entity e)
        {
            var   x          = 0;
            var   y          = 0;
            bool  closeToAct = true;
            bool  tooFar     = false;
            var   alogrithim = 0;
            Morgs morgs      = e as Morgs;

            if (morgs != null)
            {
                var position1 = morgs.Location1;
                var position2 = morgs.Location2;
                switch (position1)
                {
                case "11":
                    x = 11;
                    break;

                case "7":
                    x = 7;
                    break;

                case "22":
                    x = 22;
                    break;

                default:
                    x = 0;
                    break;
                }
                switch (position2)
                {
                case "10":
                    y = 10;
                    break;

                case "12":
                    y = 12;
                    break;

                case "7":
                    y = 7;
                    break;

                default:
                    y = 5;
                    break;
                }
            }
            alogrithim = x + y;
            if (alogrithim / 2 < 10)
            {
                return(closeToAct);
            }
            else
            {
                return(tooFar);
            }
        }
Ejemplo n.º 5
0
        protected override void Eat(Entity e)
        {
            Morgs morgs = e as Morgs;

            if (CloseEnough(morgs))
            {
                Type(morgs);
                Move(morgs);
                Hunt(morgs);
            }
            else
            {
                Type(morgs);
                Move(morgs);
            }
        }
Ejemplo n.º 6
0
        public List <Morgs> BuilldMorgs(Morgs m)
        {
            var x               = WrappedMorgs.GetState().Substring(WrappedMorgs.GetState().Length + Begin(0), End(95)).ToArray();
            var name            = x.GetValue(0).ToString();
            var location1       = x.GetValue(1).ToString() + x.GetValue(2);
            var location2       = x.GetValue(3).ToString() + x.GetValue(4);
            var movemnt         = x.GetValue(5).ToString() + x.GetValue(6) + x.GetValue(7) + x.GetValue(8) + x.GetValue(9) + x.GetValue(10) + x.GetValue(11);
            var feedingBehavior = x.GetValue(12).ToString() + x.GetValue(13) + x.GetValue(14) + x.GetValue(15) + x.GetValue(16) + x.GetValue(17) + x.GetValue(18) + x.GetValue(19) +
                                  x.GetValue(20) + x.GetValue(21) + x.GetValue(22);
            var nameMechanical      = x.GetValue(27).ToString();
            var location1Mechanical = x.GetValue(28).ToString() + x.GetValue(29);
            var location2Mechanical = x.GetValue(30).ToString() + x.GetValue(31);
            var movementMechanical  = x.GetValue(32).ToString() + x.GetValue(33) + x.GetValue(34) + x.GetValue(35) +
                                      x.GetValue(36);
            var feedingMechanicalBehavior = x.GetValue(37).ToString() + x.GetValue(38) + x.GetValue(39) + x.GetValue(40) +
                                            x.GetValue(41) + x.GetValue(42) + x.GetValue(43) + x.GetValue(44) +
                                            x.GetValue(45) + x.GetValue(46);
            var nameOrganic      = x.GetValue(51).ToString();
            var location1Organic = x.GetValue(52).ToString();
            var location2Organic = x.GetValue(53).ToString();
            var movementOrganic  = x.GetValue(54).ToString() + x.GetValue(55) + x.GetValue(56) + x.GetValue(57) +
                                   x.GetValue(58) + x.GetValue(59) + x.GetValue(60);
            var feedingOrganicBehavior = x.GetValue(61).ToString() + x.GetValue(62) + x.GetValue(63) + x.GetValue(64) +
                                         x.GetValue(65) + x.GetValue(66) + x.GetValue(67) + x.GetValue(68) +
                                         x.GetValue(69) + x.GetValue(70) + x.GetValue(71) + x.GetValue(72);
            var nameCyborg      = x.GetValue(77).ToString();
            var location1Cyborg = x.GetValue(78).ToString() + x.GetValue(79);
            var location2Cyborg = x.GetValue(80).ToString();
            var movementCyborg  = x.GetValue(81).ToString() + x.GetValue(82) + x.GetValue(83) + x.GetValue(84) +
                                  x.GetValue(85) + x.GetValue(85);
            var feedingCyborgBehavior = x.GetValue(86).ToString() + x.GetValue(87) + x.GetValue(88) + x.GetValue(89) +
                                        x.GetValue(90) + x.GetValue(91) + x.GetValue(92) + x.GetValue(93) + x.GetValue(94);
            Morgs           morg            = new Morgs(name, location1, location2, feedingBehavior, movemnt);
            MechanicalMorgs mechanicalMorgs = new MechanicalMorgs(nameMechanical, location1Mechanical, location2Mechanical, movementMechanical, feedingMechanicalBehavior);
            OrganicMorgs    organicMorgs    = new OrganicMorgs(nameOrganic, location1Organic, location2Organic, movementOrganic, feedingOrganicBehavior);
            CyborgMorgs     cyborgMorgs     = new CyborgMorgs(nameCyborg, location1Cyborg, location2Cyborg, movementCyborg, feedingCyborgBehavior);
            List <Morgs>    h = new List <Morgs>();


            h.Add(morg);
            h.Add(mechanicalMorgs);
            h.Add(organicMorgs);
            h.Add(cyborgMorgs);

            return(h);
        }
Ejemplo n.º 7
0
        protected override void Move(Entity e)
        {
            Morgs morgs = e as Morgs;

            if (morgs != null)
            {
                var action = morgs.Movement;
                switch (action)
                {
                case "Paddles":
                    Console.WriteLine(morgs.Name + " is flying");
                    break;

                case "Oozes":
                    Console.WriteLine(morgs.Name + " is crawling");
                    break;

                default:
                    Console.WriteLine(morgs.Name + " is not moving!!!");
                    break;
                }
            }
        }
Ejemplo n.º 8
0
        protected override void Move(Entity e)
        {
            Morgs morgs = e as Morgs;

            if (morgs != null)
            {
                var action = morgs.Movement;
                switch (action)
                {
                case "Invades":
                    Console.WriteLine(morgs.Name + " is Invading");
                    break;

                case "Hides":
                    Console.WriteLine(morgs.Name + " is Hiding");
                    break;

                default:
                    Console.WriteLine(morgs.Name + " is not moving!!!");
                    break;
                }
            }
        }
Ejemplo n.º 9
0
        protected override bool CloseEnough(Entity e)
        {
            var   x          = 0;
            var   y          = 0;
            bool  closeToAct = true;
            bool  tooFar     = false;
            var   alogrithim = 0;
            Morgs morgs      = e as Morgs;

            if (morgs != null)
            {
                var position1 = morgs.Location1;
                var position2 = morgs.Location2;
                switch (position1)
                {
                case "24":
                    x = 24;
                    break;

                case "13":
                    x = 13;
                    break;

                case "6":
                    x = 6;
                    break;

                case "21":
                    x = 21;
                    break;

                default:
                    x = 1;
                    break;
                }
                switch (position2)
                {
                case "33":
                    y = 33;
                    break;

                case "42":
                    y = 42;
                    break;

                case "7":
                    y = 7;
                    break;

                case "6":
                    y = 6;
                    break;

                default:
                    y = 1;
                    break;
                }
            }
            alogrithim = x + y;
            if (alogrithim / 2 > 0)
            {
                return(closeToAct);
            }
            else
            {
                return(tooFar);
            }
        }