Пример #1
0
        public void GetVisibleSpidersTest()
        {
            Worker          worker1  = new Worker(new Position(2, 2));
            Warrior         warrior1 = new Warrior(new Position(3, 3));
            Spider          spider1  = new Spider(new Position(2, 3));
            Spider          spider2  = new Spider(new Position(3, 2));
            XmlReaderWriter reader   = new XmlReaderWriter();

            reader.ReadMe("..\\..\\tests\\test-RAIN-anthill.xml");


            AHGraphics.Init();

            Simulation tmp_isw = new Simulation(new Map(AntHillConfig.mapColCount, AntHillConfig.mapRowCount, AntHillConfig.tiles));

            tmp_isw.ants.AddLast(worker1);
            tmp_isw.ants.AddLast(warrior1);
            tmp_isw.spiders.AddLast(spider1);
            tmp_isw.spiders.AddLast(spider2);

            Rain test_rain = new Rain(new Position(2, 3));

            tmp_isw.rain = test_rain;

            LIList <Spider> list1 = tmp_isw.GetVisibleSpiders(test_rain);
            LIList <Spider> list2 = tmp_isw.GetVisibleSpiders(warrior1);
            LIList <Spider> list3 = tmp_isw.GetVisibleSpiders(worker1);
            LIList <Spider> list4 = tmp_isw.GetVisibleSpiders(spider2);

            Assert.IsTrue(list1.Contains(spider1), "GetVisibleAntsTest problem to see spider by rain");
            Assert.IsTrue(list2.Contains(spider1), "GetVisibleAntsTest problem to see spider by warriror");
            Assert.IsTrue(list3.Contains(spider1), "GetVisibleAntsTest problem to see spider by worker");
            Assert.IsTrue(list4.Contains(spider1), "GetVisibleAntsTest problem to see spider by rain");
        }
Пример #2
0
        public LIList <Message> GetVisibleMessages(Element c)
        {
            LIList <Message>         res_messages = new LIList <Message>();
            LinkedListNode <Message> messageNode;

            if (c is Ant)
            {
                messageNode = Map.GetTile(c.Position).messages.First;
                while (messageNode != null)
                {
                    res_messages.AddLast(messageNode.Value);
                    messageNode = messageNode.Next;
                }
            }
            else if (c is Rain)
            {
                for (int i = 0; i < AntHillConfig.rainWidth; i++)
                {
                    for (int j = 0; j < AntHillConfig.rainWidth; j++)
                    {
                        messageNode = Map.GetTile(c.Position.X + i, c.Position.Y + j).messages.First;
                        while (messageNode != null)
                        {
                            if (!res_messages.Contains(messageNode.Value))
                            {
                                res_messages.AddLast(messageNode.Value);
                            }
                            messageNode = messageNode.Next;
                        }
                    }
                }
            }
            return(res_messages);
        }
Пример #3
0
        private void RewriteTiles(Tile[] destTiles, LIList <Tile> srcTiles)
        {
            LinkedListNode <Tile> node = srcTiles.First;
            int i = 0;

            while (node != null)
            {
                destTiles[i++] = node.Value;
                node           = node.Next;
            }
        }
Пример #4
0
 public PointWithIntensity GetPointWithIntensity(Position p)
 {
     LIList <PointWithIntensity> .Enumerator e = points.GetEnumerator();
     while (e.MoveNext())
     {
         if (e.Current.Tile.Position == p)
         {
             return(e.Current);
         }
     }
     return(null);
 }
Пример #5
0
        public void CitizenTest()
        {
            Worker          worker1 = new Worker(new Position(2, 2));
            Worker          worker2 = new Worker(new Position(3, 3));
            XmlReaderWriter reader  = new XmlReaderWriter();

            reader.ReadMe("..\\..\\tests\\test-RAIN-anthill.xml");


            AHGraphics.Init();
            /*test AddSet() function*/
            Simulation tmp_isw = new Simulation(new Map(AntHillConfig.mapColCount, AntHillConfig.mapRowCount, AntHillConfig.tiles));

            //Message message = new Message(new Position(2, 2), MessageType.FoodLocalization, new Position(0,0));
            tmp_isw.CreateMessage(new Position(2, 2), MessageType.FoodLocalization, new Position(0, 0));
            tmp_isw.ants.AddLast(worker1);
            tmp_isw.ants.AddLast(worker2);

            //tmp_isw.messages.AddLast(message);
            //worker1.AddToSet(message,2);
            //worker1.SpreadSignal(tmp_isw);

            LIList <Message> list  = tmp_isw.GetVisibleMessages(worker2);
            bool             check = list.Count != 0;

            Assert.IsTrue(check, "problem with adding messages");

            /*test GetNearestFood()*/
            LIList <Food> foodList = new LIList <Food>();

            foodList.AddLast(new Food(new Position(4, 4), 1));
            foodList.AddLast(new Food(new Position(8, 8), 3));
            foodList.AddLast(new Food(new Position(2, 3), 3));
            foodList.AddLast(new Food(new Position(1, 1), 3));
            Food nFood = worker1.testGetNearestFood(foodList);

            Assert.AreEqual(new Position(2, 3), nFood.Position, "finding nearest food problem");

            /*test ReadMessage()*/
            Worker worker3 = new Worker(new Position(4, 4));

            worker3.AddToSet(new Message(new Position(5, 5), MessageType.FoodLocalization, new Position(0, 0)), 1);
            worker3.AddToSet(new Message(new Position(1, 1), MessageType.FoodLocalization, new Position(0, 0)), 3);
            worker3.AddToSet(new Message(new Position(3, 3), MessageType.FoodLocalization, new Position(0, 0)), 2);
            Message nMessage = worker3.testReadMessage(MessageType.FoodLocalization);

            Assert.AreEqual(new Position(1, 1), nMessage.Position, "ReadMessage function problem in Citizen");
        }
Пример #6
0
 private void Initialize()
 {
     _map = null;
     eggs = new LIList <Egg>();
     eggs.Clear();
     messages = new LIList <Message>();
     messages.Clear();
     food = new LIList <Food>();
     food.Clear();
     spiders = new LIList <Spider>();
     spiders.Clear();
     ants = new LIList <Ant>();
     ants.Clear();
     rain  = null;
     queen = new Queen(new Position(AntHillConfig.queenXPosition, AntHillConfig.queenYPosition));
 }
Пример #7
0
        public Spider GetNearestSpider(LIList <Spider> spiders)
        {
            int min = Int32.MaxValue;
            int tmp;

            LIList <Spider> .Enumerator e = spiders.GetEnumerator();
            Spider bestSpider             = null;

            while (e.MoveNext())
            {
                if ((tmp = DistanceMeasurer.Taxi(this.Position, e.Current.Position)) < min)
                {
                    bestSpider = e.Current;
                    min        = tmp;
                }
            }
            return(bestSpider);
        }
Пример #8
0
        public void GetVisibleMessagesTest()
        {
            Worker          worker1      = new Worker(new Position(2, 2));
            Warrior         warrior1     = new Warrior(new Position(3, 3));
            Message         message1_tmp = new Message(new Position(2, 2), MessageType.QueenIsHungry, new Position(0, 0));
            Message         message2_tmp = new Message(new Position(3, 3), MessageType.QueenInDanger, new Position(0, 0));
            XmlReaderWriter reader       = new XmlReaderWriter();

            reader.ReadMe("..\\..\\tests\\test-RAIN-anthill.xml");

            AHGraphics.Init();

            Simulation tmp_isw = new Simulation(new Map(AntHillConfig.mapColCount, AntHillConfig.mapRowCount, AntHillConfig.tiles));

            tmp_isw.ants.AddLast(worker1);
            tmp_isw.ants.AddLast(warrior1);

            tmp_isw.CreateMessage(new Position(2, 2), MessageType.QueenIsHungry, new Position(0, 0));
            tmp_isw.CreateMessage(new Position(3, 3), MessageType.QueenInDanger, new Position(0, 0));


            Rain test_rain = new Rain(new Position(3, 3));

            tmp_isw.rain = test_rain;

            LIList <Message> list1 = tmp_isw.GetVisibleMessages(test_rain);
            LIList <Message> list2 = tmp_isw.GetVisibleMessages(warrior1);
            LIList <Message> list3 = tmp_isw.GetVisibleMessages(worker1);

            Assert.AreEqual(list1.First.Value.Position, message1_tmp.Position, "GetVisibleMessagesTest problem to see message by rain (POSITION)");
            Assert.AreEqual(list1.First.Value.GetMessageType, message1_tmp.GetMessageType, "GetVisibleMessagesTest problem to see message by rain (MESSAGETYPE)");
            Assert.AreEqual(list1.First.Value.TargetPosition, message1_tmp.TargetPosition, "GetVisibleMessagesTest problem to see message by rain (TARGETPOS)");

            Assert.AreEqual(list2.Last.Value.Position, message2_tmp.Position, "GetVisibleMessagesTest problem to see message by warriror (POSITION)");
            Assert.AreEqual(list2.Last.Value.GetMessageType, message2_tmp.GetMessageType, "GetVisibleMessagesTest problem to see message by warriror (MESSAGETYPE)");
            Assert.AreEqual(list2.Last.Value.TargetPosition, message2_tmp.TargetPosition, "GetVisibleMessagesTest problem to see message by warriror (TARGETPOS)");

            Assert.AreEqual(list3.First.Value.Position, message1_tmp.Position, "GetVisibleMessagesTest problem to see message by worker (POSITION)");
            Assert.AreEqual(list3.First.Value.GetMessageType, message1_tmp.GetMessageType, "GetVisibleMessagesTest problem to see message by worker (MESSAGETYPE)");
            Assert.AreEqual(list3.First.Value.TargetPosition, message1_tmp.TargetPosition, "GetVisibleMessagesTest problem to see message by worker (TARGETPOS)");
        }
Пример #9
0
        protected Food GetNearestFood(LIList <Food> foods)
        {
            if (foods.Count == 0)
            {
                return(null);
            }

            Food bestFood = null;
            int  min      = Int32.MaxValue;
            int  tmp;

            LIList <Food> .Enumerator e = foods.GetEnumerator();
            while (e.MoveNext())
            {
                if ((tmp = DistanceMeasurer.Taxi(this.Position, e.Current.Position)) < min)
                {
                    bestFood = e.Current;
                    min      = tmp;
                }
            }
            return(bestFood);
        }
Пример #10
0
        private Ant FindNearestAnt()
        {
            if (Simulation.simulation.queen == null)
            {
                return(null);
            }
            if (AntHillConfig.antSightRadius >= DistanceMeasurer.Taxi(Simulation.simulation.queen.Position, this.Position))
            {
                return(Simulation.simulation.queen);
            }

            LIList <Ant> ants = Simulation.simulation.GetVisibleAnts(this);

            if (ants == null)
            {
                return(null);
            }
            if (ants.Count == 0)
            {
                return(null);
            }
            int minDistance = DistanceMeasurer.Taxi(ants.First.Value.Position, Position);

            int distance;
            Ant bestAnt = null;

            LIList <Ant> .Enumerator ant = ants.GetEnumerator();
            while (ant.MoveNext())
            {
                if ((distance = DistanceMeasurer.Taxi(this.Position, ant.Current.Position)) < minDistance)
                {
                    bestAnt     = ant.Current;
                    minDistance = distance;
                }
            }
            return(bestAnt);
        }
Пример #11
0
        public LIList <Food> GetVisibleFood(Element c)
        {
            LIList <Food>         res_food = new LIList <Food>();
            LinkedListNode <Food> foodNode = food.First;

            if (c is Spider || c is Ant) //same radius
            {
                int radius2 = AntHillConfig.antSightRadius * AntHillConfig.antSightRadius;
                while (foodNode != null)
                {
                    int dx = foodNode.Value.Position.X - c.Position.X;
                    int dy = foodNode.Value.Position.Y - c.Position.Y;
                    if (dx * dx + dy * dy <= radius2)
                    {
                        if (_map.CheckVisibility(c.Position, foodNode.Value.Position))
                        {
                            res_food.AddLast(foodNode.Value);
                        }
                    }
                    foodNode = foodNode.Next;
                }
            }
            else if (c is Rain)
            {
                while (foodNode != null)
                {
                    if (_map.GetTile(foodNode.Value.Position).TileType == TileType.Outdoor &&
                        ((Rain)c).IsRainOver(foodNode.Value.Position))
                    {
                        res_food.AddLast(foodNode.Value);
                    }
                    foodNode = foodNode.Next;
                }
            }
            return(res_food);
        }
Пример #12
0
        public LIList <Spider> GetVisibleSpiders(Element c)
        {
            LIList <Spider>         res_spiders = new LIList <Spider>();
            LinkedListNode <Spider> spiderNode  = spiders.First;

            if (c is Spider || c is Ant) //same radius
            {
                int radius2 = AntHillConfig.antSightRadius * AntHillConfig.antSightRadius;
                while (spiderNode != null)
                {
                    int dx = spiderNode.Value.Position.X - c.Position.X;
                    int dy = spiderNode.Value.Position.Y - c.Position.Y;
                    if (dx * dx + dy * dy <= radius2)
                    {
                        if (_map.CheckVisibility(c.Position, spiderNode.Value.Position))
                        {
                            res_spiders.AddLast(spiderNode.Value);
                        }
                    }
                    spiderNode = spiderNode.Next;
                }
            }
            else if (c is Rain)
            {
                while (spiderNode != null)
                {
                    if (_map.GetTile(spiderNode.Value.Position).TileType == TileType.Outdoor &&
                        ((Rain)c).IsRainOver(spiderNode.Value.Position))
                    {
                        res_spiders.AddLast(spiderNode.Value);
                    }
                    spiderNode = spiderNode.Next;
                }
            }
            return(res_spiders);
        }
Пример #13
0
 public Tile(TileType ttype, Position pos)
 {
     position = new Position(pos);
     tileType = ttype;
     messages = new LIList <Message>();
 }
Пример #14
0
 public Message(Position pos, MessageType mt, Position targetPosition) : base(pos)
 {
     type   = mt;
     points = new LIList <PointWithIntensity>();
     this.targetPosition = new Position(targetPosition);
 }
Пример #15
0
        public override bool Maintain(ISimulationWorld isw)
        {
            if (--timeToLive < 0)
            {
                isw.DeleteRain();
                return(false);
            }

            LIList <Food>    lFood    = isw.GetVisibleFood(this);
            LIList <Ant>     lAnt     = isw.GetVisibleAnts(this);
            LIList <Spider>  lSpider  = isw.GetVisibleSpiders(this);
            LIList <Message> lMessage = isw.GetVisibleMessages(this);

            while (lFood.Count > 0)
            {
                isw.DeleteFood(lFood.First.Value);
                lFood.RemoveFirst();
            }

            while (lAnt.Count > 0)
            {
                isw.DeleteAnt(lAnt.First.Value);
                lAnt.RemoveFirst();
            }
            while (lSpider.Count > 0)
            {
                isw.DeleteSpider(lSpider.First.Value);
                lSpider.RemoveFirst();
            }

            Map map = isw.GetMap();

            if (lMessage != null)
            {
                LinkedListNode <Message>            enumMsg = lMessage.First;
                LinkedListNode <PointWithIntensity> enumPwI, enumPwItemp;
                while (enumMsg != null)
                {
                    enumPwI = enumMsg.Value.Points.First;
                    while (enumPwI != null)
                    {
                        if (IsRainOver(enumPwI.Value.Position))
                        {
                            map.RemoveMessage(enumMsg.Value.GetMessageType, enumPwI.Value.Position);
                            enumPwItemp = enumPwI;
                            enumPwI     = enumPwI.Next;
                            enumMsg.Value.Points.Remove(enumPwItemp);
                        }
                        else
                        {
                            enumPwI = enumPwI.Next;
                        }
                    }
                    enumMsg = enumMsg.Next;
                }
            }

            // Rain is always on the map
            for (int i = 0; i < AntHillConfig.rainWidth; i++)     // && i+this.Position.X < map.Width; i++)
            {
                for (int j = 0; j < AntHillConfig.rainWidth; j++) // && j+this.Position.Y < map.Height; j++)
                {
                    map.GetTile(this.Position.X + i, this.Position.Y + j).messages.Clear();
                }
            }
            return(true);
        }
Пример #16
0
        public override bool Maintain(ISimulationWorld isw)
        {//TODO malo:)
            if (!base.IsAlive())
            {
                return(false);
            }

            SpreadSignal(isw);
            LIList <Message> .Enumerator msg = isw.GetVisibleMessages(this).GetEnumerator();
            while (msg.MoveNext())
            {
                this.AddToSet(msg.Current, msg.Current.GetPointWithIntensity(this.Position).Intensity);
            }

            LIList <Spider> spiders;

            if ((spiders = isw.GetVisibleSpiders(this)).Count != 0)
            {
                Spider spider = GetNearestSpider(spiders);
                if (spider != lastSpider)
                {
                    if (!FindEqualSignal(MessageType.SpiderLocalization, spider.Position))
                    {
                        isw.CreateMessage(this.Position, MessageType.SpiderLocalization, spider.Position);
                        lastSpider = spider;
                    }
                }
                MoveRotateOrAttack(this, spider, isw);
                randomDestination.X = -1;
                return(true);
            }
            if (MaintainSignals(MessageType.QueenInDanger))
            {
                randomDestination.X = -1;
                return(true);
            }
            if (MaintainSignals(MessageType.SpiderLocalization))
            {
                randomDestination.X = -1;
                return(true);
            }

            // teraz wcinamy

            LIList <Food> foods = isw.GetVisibleFood(this);

            if (foods.Count != 0)
            {
                Food food     = GetNearestFood(foods);
                int  distance = DistanceMeasurer.Taxi(this.Position, food.Position);
                if (food != lastFood)
                {
                    if (!FindEqualSignal(MessageType.FoodLocalization, food.Position))
                    {
                        isw.CreateMessage(this.Position, MessageType.FoodLocalization, food.Position);
                        lastFood = food;
                    }
                }
                if (this.TurnsToBecomeHungry <= 0)
                {
                    if (distance == 0)
                    {
                        food.Maintain(isw);
                        this.Eat();

                        randomDestination.X = -1;
                        return(true);
                    }
                    List <KeyValuePair <int, int> > trail = Astar.Search(new KeyValuePair <int, int>(this.Position.X, this.Position.Y), new KeyValuePair <int, int>(food.Position.X, food.Position.Y), new AstarOtherObject());
                    if (trail == null)
                    {
                        randomDestination.X = -1;
                        return(true);
                    }
                    if (trail.Count <= 1)
                    {
                        randomDestination.X = -1;
                        return(true);
                    }
                    MoveOrRotate(trail[1]);
                    randomDestination.X = -1;
                    return(true);
                }
            }
            else
            {
                if (MaintainSignals(MessageType.FoodLocalization))
                {
                    randomDestination.X = -1;
                    return(true);
                }
            }

            MoveRandomly(isw);
            return(true);
        }
Пример #17
0
        public Map(int w, int h, Tile[,] tiles)
        {
            this._width  = w;
            this._height = h;

            this._tiles = new Tile[w, h];
            for (int x = 0; x < w; x++)
            {
                for (int y = 0; y < h; y++)
                {
                    this._tiles[x, y] = new Tile(tiles[x, y].TileType, tiles[x, y].Position);
                }
            }

            _messagesCount = new MessageCount[_width, _height];

            LIList <Tile> indoorTilesTemp  = new LIList <Tile>(),
                          wallTilesTemp    = new LIList <Tile>(),
                          outdoorTilesTemp = new LIList <Tile>();
            Tile t;

            for (int y = 0; y < this._height; y++)
            {
                for (int x = 0; x < this._width; x++)
                {
                    switch ((t = tiles[x, y]).TileType)
                    {
                    case TileType.Outdoor:
                        outdoorTilesTemp.AddLast(t);
                        break;

                    case TileType.Indoor:
                        indoorTilesTemp.AddLast(t);
                        break;

                    case TileType.Wall:
                        wallTilesTemp.AddLast(t);
                        break;
                    }
                }
            }

            if (outdoorTilesTemp.Count == 0)
            {
                throw new Exception(Properties.Resources.noOutdoorTilesError);
            }
            if (indoorTilesTemp.Count == 0)
            {
                throw new Exception(Properties.Resources.noIndoorTilesError);
            }

            _indoorTiles       = new Tile[indoorTilesTemp.Count + wallTilesTemp.Count];
            _wallTiles         = new Tile[indoorTilesTemp.Count + wallTilesTemp.Count];
            _outdoorTiles      = new Tile[outdoorTilesTemp.Count];
            _indoorTilesCount  = indoorTilesTemp.Count;
            _wallTilesCount    = wallTilesTemp.Count;
            _outdoorTilesCount = outdoorTilesTemp.Count;

            RewriteTiles(_indoorTiles, indoorTilesTemp);
            RewriteTiles(_outdoorTiles, outdoorTilesTemp);
            RewriteTiles(_wallTiles, wallTilesTemp);
        }
Пример #18
0
 public Food testGetNearestFood(LIList <Food> food)
 {
     return(this.GetNearestFood(food));
 }
Пример #19
0
        public override bool Maintain(ISimulationWorld isw)
        {
            if (!base.IsAlive())
            {
                return(false);
            }

            SpreadSignal(isw);
            LIList <Food>   food;
            LIList <Spider> spiders;

            spiders = isw.GetVisibleSpiders(this);
            if (spiders.Count != 0)
            {
                Spider s = this.GetNearestSpider(spiders);
                if (s != lastSpider)
                {
                    if (!FindEqualSignal(MessageType.SpiderLocalization, s.Position))
                    {
                        isw.CreateMessage(this.Position, MessageType.SpiderLocalization, s.Position);
                        lastSpider = s;
                    }
                }
            }
            LIList <Message> .Enumerator msg = isw.GetVisibleMessages(this).GetEnumerator();
            while (msg.MoveNext())
            {
                this.AddToSet(msg.Current, msg.Current.GetPointWithIntensity(this.Position).Intensity);
            }

            if (this.TurnsToBecomeHungry <= 0)
            {
                if (this.foodQuantity > 0)
                {
                    foodQuantity--;
                    Eat();
                }
            }

            if (this.foodQuantity == 0) //search for food
            {
                path = null;
                food = isw.GetVisibleFood(this);

                if (food.Count != 0)
                {// idzie do jedzenia
                    Food nearestFood = this.GetNearestFood(food);
                    int  dist        = DistanceMeasurer.Taxi(this.Position, nearestFood.Position);
                    if (dist == 0)
                    {
                        this.FoodQuantity = nearestFood.GetQuantity;
                        isw.DeleteFood(nearestFood);
                    }
                    else
                    {
                        if (nearestFood != lastFood)
                        {
                            if (!FindEqualSignal(MessageType.FoodLocalization, nearestFood.Position))
                            {
                                isw.CreateMessage(this.Position, MessageType.FoodLocalization, nearestFood.Position);
                                lastFood = nearestFood;
                            }
                        }
                        // znajdujemy t¹ krótk¹ œcie¿kê - wyliczane co 'maintain'
                        List <KeyValuePair <int, int> > trail = Astar.Search(new KeyValuePair <int, int>(this.Position.X, this.Position.Y), new KeyValuePair <int, int>(nearestFood.Position.X, nearestFood.Position.Y), new AstarOtherObject());
                        if (trail.Count >= 2)
                        {
                            MoveOrRotateOrDig(isw, trail[1]);
                            randomDestination.X = -1;
                            return(true);
                        }
                    }
                }
                else
                {// nie widzi
                    Message m = _messages[(int)MessageType.FoodLocalization];
                    if (m != null)
                    {
                        // ma sygnal o najwiekszej intensywnosci
                        List <KeyValuePair <int, int> > trail = Astar.Search(new KeyValuePair <int, int>(this.Position.X, this.Position.Y), new KeyValuePair <int, int>(m.Position.X, m.Position.Y), new AstarWorkerObject());
                        if (trail.Count >= 2)
                        {
                            MoveOrRotateOrDig(isw, trail[1]);
                            randomDestination.X = -1;
                            return(true);
                        }
                    }
                }
            }
            else
            {
                int dist = DistanceMeasurer.Taxi(this.Position, Simulation.simulation.queen.Position);
                if (dist == 0)
                {
                    isw.FeedQueen(this);
                    path = null;
                }
                else
                {
                    if (path == null || path.Count < 2)
                    {
                        path = Astar.Search(new KeyValuePair <int, int>(this.Position.X, this.Position.Y), new KeyValuePair <int, int>(Simulation.simulation.queen.Position.X, Simulation.simulation.queen.Position.Y), new AstarWorkerObject());
                    }
                    if (path.Count >= 2)
                    {
                        if (MoveOrRotateOrDig(isw, path[1]))
                        {
                            path.RemoveAt(0);
                        }
                        randomDestination.X = -1;
                        return(true);
                    }
                }
            }

            MoveRandomly(isw);

            return(true);
        }
Пример #20
0
        private void openGLControl_Paint(object sender, PaintEventArgs ea)
        {
            counter.FrameTick();

            //Gl.glClearColor(0, 0, 0, 0);
            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);

            if (!cbVisualize.Checked)
            {
                return;
            }

            Gl.glLoadIdentity();
            Glu.gluLookAt(0, AntHillConfig.curMagnitude * 10.0f, AntHillConfig.curMagnitude * -20.0f,
                          0, 0, 0,
                          0, -1, 0);  //0.5f * Math.Sqrt(2), 0.5f * Math.Sqrt(2));
            Gl.glRotated(lookAtAngleX, 1.0d, 0.0d, 0.0d);
            Gl.glRotated(lookAtAngleY, 0.0d, 1.0d, 0.0d);
            if (Simulation.simulation == null)
            {
                return;
            }

            Map map = Simulation.simulation.Map;

            int signal;

            Gl.glColor4f(1, 1, 1, 1);
            for (int x = 0; x < map.Width; x++)
            {
                for (int y = 0; y < map.Height; y++)
                {
                    //if (ShouldOmitDrawing(x, y)) continue;
                    DrawElement(x, y, map.GetTile(x, y).GetTexture(), Dir.N, offsetX, offsetY, 1, 1, 0.0f);
                }
            }

            for (int x = 0; x < map.Width; x++)
            {
                for (int y = 0; y < map.Height; y++)
                {
                    //if (ShouldOmitDrawing(x, y)) continue;

                    if ((signal = map.MsgCount[x, y].GetCount(MessageType.FoodLocalization)) > 0)
                    {
                        Gl.glColor4f(1, 1, 1, (float)(signal + AntHillConfig.signalInitialAlpha) / AntHillConfig.signalHighestDensity);
                        DrawElement(x, y, (int)AHGraphics.Texture.MessageFoodLocation, Dir.N, offsetX, offsetY, 1, 1, 0.01f);
                    }
                    if ((signal = map.MsgCount[x, y].GetCount(MessageType.QueenInDanger)) > 0)
                    {
                        Gl.glColor4f(1, 1, 1, (float)(signal + AntHillConfig.signalInitialAlpha) / AntHillConfig.signalHighestDensity);
                        DrawElement(x, y, (int)AHGraphics.Texture.MessageQueenInDanger, Dir.N, offsetX, offsetY, 1, 1, 0.01f);
                    }
                    if ((signal = map.MsgCount[x, y].GetCount(MessageType.QueenIsHungry)) > 0)
                    {
                        Gl.glColor4f(1, 1, 1, (float)(signal + AntHillConfig.signalInitialAlpha) / AntHillConfig.signalHighestDensity);
                        DrawElement(x, y, (int)AHGraphics.Texture.MessageQueenIsHungry, Dir.N, offsetX, offsetY, 1, 1, 0.01f);
                    }
                    if ((signal = map.MsgCount[x, y].GetCount(MessageType.SpiderLocalization)) > 0)
                    {
                        Gl.glColor4f(1, 1, 1, (float)(signal + AntHillConfig.signalInitialAlpha) / AntHillConfig.signalHighestDensity);
                        DrawElement(x, y, (int)AHGraphics.Texture.MessageSpiderLocation, Dir.N, offsetX, offsetY, 1, 1, 0.01f);
                    }
                }
            }

            Gl.glColor4f(1, 1, 1, 1);
            Creature e;
            Food     f;

            LIList <Ant> .Enumerator enumerator = Simulation.simulation.ants.GetEnumerator();
            while (enumerator.MoveNext())
            {
                e = enumerator.Current;
                //if (ShouldOmitDrawing(e.Position.X, e.Position.Y)) continue;
                DrawElement(e.Position.X, e.Position.Y, e.GetTexture(), e.Direction, offsetX, offsetY, 1, 1, 0.02f);
            }
            LIList <Spider> .Enumerator enumeratorSpider = Simulation.simulation.spiders.GetEnumerator();
            while (enumeratorSpider.MoveNext())
            {
                e = enumeratorSpider.Current;
                //if (ShouldOmitDrawing(e.Position.X, e.Position.Y)) continue;
                DrawElement(e.Position.X, e.Position.Y, e.GetTexture(), e.Direction, offsetX, offsetY, 1, 1, 0.02f);
            }
            LIList <Food> .Enumerator enumeratorFood = Simulation.simulation.food.GetEnumerator();
            while (enumeratorFood.MoveNext())
            {
                f = enumeratorFood.Current;
                //if (ShouldOmitDrawing(f.Position.X, f.Position.Y)) continue;
                DrawElement(f.Position.X, f.Position.Y, f.GetTexture(), Dir.N, offsetX, offsetY, 1, 1, 0.015f);
            }

            e = Simulation.simulation.queen;
            if (e != null)// && !ShouldOmitDrawing(e.Position.X, e.Position.Y))
            {
                DrawElement(e.Position.X, e.Position.Y, e.GetTexture(), e.Direction, offsetX, offsetY, 1, 1, 0.025f);
            }

            //deszcz
            Rain rain = Simulation.simulation.rain;

            if (rain != null)
            {
                DrawElement(rain.Position.X, rain.Position.Y, rain.GetTexture(), Dir.N, offsetX, offsetY, AntHillConfig.rainWidth, AntHillConfig.rainWidth, 1.0f);
            }
        }