Пример #1
0
        public World(Size size)
        {
            IterationCount = 0;
            WorldSize = size;
            hiveSmell = new double[size.Width, size.Height];
            foodSmell = new double[size.Width, size.Height];
            for (int x = 0; x < WorldSize.Width;x++ )
                for (int y = 0; y < WorldSize.Height; y++)
                {
                    hiveSmell[x, y] = FarFarAwayValue;
                    foodSmell[x, y] = 0;
                }

            Foods = new List<Rectangle>();

            TheHive = new AntHive(new Point(
                RandomGen.Next((int)(size.Width*0.25), (int)(size.Width*0.75)),
                RandomGen.Next((int)(size.Height*0.25), (int)(size.Height*0.75))));

            int foodCount = RandomGen.Next(5, 11);
            for (int i = 0; i < foodCount; i++)
            {
                AddFood();
            }
        }
Пример #2
0
        internal Ant(AntHive hive, World world)
        {
            DirectFactor = world.RandomGen.Next(25, 99)*0.01;
            HiveBelong = hive;
            Direction = -1;

            AntPosition = hive.HivePosition;
            DistanceFromHive = 0.0;
        }