Ejemplo n.º 1
0
 public void Deliver(Celallomas celallomas, Int32 x, Int32 y)
 {
     //TODO
 }
Ejemplo n.º 2
0
        public void NewSimulation(AllData data)
        {
            savedData = new AllData();
            savedData = data;                                                // adatok betöltése
            int mID = 1, cID = 10001, pID = 20001, tID = 30001, rID = 40001; //mezo: 1-10000, cel: 10001-20000, polc: 20001-30000, tolto: 30001-40000, robot: 40001-50000

            totalEnergyUsed = 0;
            totalSteps      = 0;
            goodsDelivered  = 0;
            celallomasCount = 0;
            tableSize       = data.tableSize;
            table           = new NewmazonClasses[tableSize, tableSize];
            startingEnergy  = data.robotEnergy;
            robots          = new List <Robot>();
            robotEnergyUsed = new List <int>();

            for (int i = 0; i < tableSize; ++i)
            {
                for (int j = 0; j < tableSize; ++j)
                {
                    switch (data.dataTable[i, j])
                    {
                    case 'R':                                   //Robot
                        table[i, j] = new Mezo(mID, i, j);
                        mID++;
                        robots.Add(new Robot(rID, i, j, startingEnergy, 0, null));
                        robotEnergyUsed.Add(0);
                        rID++;
                        break;

                    case 'M':                                   //Mező
                        table[i, j] = new Mezo(mID, i, j);
                        mID++;
                        break;

                    case 'P':                                   //Polc
                        table[i, j] = new Polc(pID, i, j);
                        pID++;
                        break;

                    case 'T':                                   //Töltőállomás
                        table[i, j] = new Toltoallmoas(tID, i, j);
                        tID++;
                        break;

                    case 'F':                                   //Fal
                        table[i, j] = new Fal(0, i, j);
                        break;

                    case 'C':                                   //Célállomás
                        table[i, j] = new Celallomas(cID, i, j);
                        celallomasCount++;
                        cID++;
                        break;
                    }
                }
            }

            goods = new List <Goods>();                          // áruk listájának betöltése a datából
            foreach (Goods good in data.goods)
            {
                goods.Add(good);
            }

            paths = new List <List <Step> >(robots.Count);         // minden robotnak saját útvonal létrehozása
            for (int i = 0; i < robots.Count; ++i)
            {
                paths.Add(new List <Step>());
            }

            foreach (Goods good in data.goods)                  // polcokon lévő áruk beöltése
            {
                foreach (int i in good.destinations)
                {
                    table[good.x, good.y].goods.Add(i);
                }
            }
        }