Ejemplo n.º 1
0
        public Map(Rovio.BaseArena r, Control.ControlCollection c, int x, int y)
        {
            robot = r;
            maxY = 300 / 10;
            maxX = 260 / 10;
            finalMap = new bool[maxX, maxY];
            isCellVisible = new bool[maxX, maxY];
            preySensor = new bool[maxX, maxY];
            preyProbability = new double[maxX, maxY];
            obstacleSensor = new bool[maxX, maxY];
            obstacleProbability = new double[maxX, maxY];
            for (int i = 0; i < maxX; i++)
            {
                for (int j = 0; j < maxY; j++)
                {
                    finalMap[i, j] = false;
                    preyProbability[i, j] = 0.5;
                    obstacleProbability[i, j] = 0.5;
                    isCellVisible[i, j] = false;
                    preySensor[i, j] = false;
                    obstacleSensor[i, j] = false;
                }
            }

            SetPictureBox(c, ref picBoxBayes, ref bBayes, 260, 300, 0, 0);
            SetPictureBox(c, ref picBoxObstacle, ref bObstacle, 30, 30, -100, -100);
            SetPictureBox(c, ref picBoxPrey, ref bPrey, 3, 3, -100, -100);
            SetPictureBox(c, ref picBoxRovio, ref bRovio, 24, 27, -100, -100);
            SetPictureBox(c, ref picBoxCone, ref bCone, 138, 150, -500, -500);
            SetPictureBox(c, ref picBoxPath, ref bPath, 260, 300, 0, 0);

            picBoxBayes.BackColor = System.Drawing.Color.Transparent;
            picBoxPath.BackColor = System.Drawing.Color.Transparent;
            SetPictureBox(c, ref picBoxMap, ref bMap, 260, 300, x, y);
            picBoxMap.BackColor = System.Drawing.Color.Transparent;
            picBoxBayes.Location = new System.Drawing.Point(0, 0);

            DrawGraphics();

            picBoxCone.Parent = picBoxBayes;
            picBoxRovio.Parent = picBoxMap;
            picBoxObstacle.Parent = picBoxBayes;
            picBoxPrey.Parent = picBoxBayes;
            picBoxBayes.Parent = picBoxMap;
            picBoxPath.Parent = picBoxBayes;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Called from main form. Begin the update function and assign a robot to the map.
 /// </summary>
 /// <param name="r">Input robot.</param>
 public void SetUpdate(Rovio.BaseArena r)
 {
     robot = r;
     picBoxRovio.Location = new DPoint(100, 100);
     timer = new Timer();
     timer.Tick += Update;
     timer.Start();
 }