private static void Setup(string[] inputs)
    {
        int nbFloors = int.Parse(inputs[0]);               // number of floors
        int width    = int.Parse(inputs[1]);               // width of the area

        int nbRounds               = int.Parse(inputs[2]); // maximum number of rounds
        var exitFloor              = int.Parse(inputs[3]);
        var exitPos                = int.Parse(inputs[4]);
        int nbTotalClones          = int.Parse(inputs[5]); // number of generated clones
        var numberElevatorsToBuild = int.Parse(inputs[6]);
        int nbElevators            = int.Parse(inputs[7]); // number of elevators

        var floors = new Floors();

        for (int i = 0; i < nbElevators; i++)
        {
            inputs = Console.ReadLine().Split(' ');
            int elevatorFloor = int.Parse(inputs[0]); // floor on which this elevator is found
            int elevatorPos   = int.Parse(inputs[1]); // position of the elevator on its floor

            if (floors.ContainsKey(elevatorFloor))
            {
                floors[elevatorFloor].Elevators.Add(elevatorPos);
            }
            else
            {
                floors.Add(elevatorFloor, new Floor(elevatorPos));
            }
        }

        for (int i = 0; i <= nbFloors; i++)
        {
            if (!floors.ContainsKey(i))
            {
                floors[i] = new Floor();
            }
        }

        _game = new Game(floors, exitFloor, exitPos, numberElevatorsToBuild);
        _game.SetGeneralProperties(nbRounds, nbTotalClones, width);
    }
Esempio n. 2
0
 public void AddFrom(MfModelDicts dict)
 {
     foreach (var c in dict.Cates)
     {
         if (!Cates.ContainsKey(c.Key))
         {
             Cates.Add(c.Key, c.Value);
         }
     }
     foreach (var c in dict.Elems)
     {
         if (!Elems.ContainsKey(c.Key))
         {
             Elems.Add(c.Key, c.Value);
         }
     }
     foreach (var c in dict.Fams)
     {
         if (!Fams.ContainsKey(c.Key))
         {
             Fams.Add(c.Key, c.Value);
         }
     }
     foreach (var c in dict.Floors)
     {
         if (!Floors.ContainsKey(c.Key))
         {
             Floors.Add(c.Key, c.Value);
         }
     }
     foreach (var c in dict.Mats)
     {
         if (!Mats.ContainsKey(c.Key))
         {
             Mats.Add(c.Key, c.Value);
         }
     }
     foreach (var c in dict.Types)
     {
         if (!Types.ContainsKey(c.Key))
         {
             Types.Add(c.Key, c.Value);
         }
     }
     foreach (var c in dict.Views)
     {
         if (!Views.ContainsKey(c.Key))
         {
             Views.Add(c.Key, c.Value);
         }
     }
 }
Esempio n. 3
0
 public IFloor GetFloor(int level)
 {
     return(Floors.ContainsKey(level) ? Floors[level] : null);
 }