Ejemplo n.º 1
0
 public List <Vagon> createTrain(List <Vagon> train)
 {
     for (int i = 0; i < RandomClass.randomAmountOfVagons(); i++)
     {
         train.Add(new Vagon());
     }
     return(train);
 }
Ejemplo n.º 2
0
        public void trainFunction(List <Vagon> train)
        {
            Console.WriteLine(train.Count);
            int i = RandomClass.occurrenceVagon(train.Count);

            label :   showInfoAboutVagon(train, i);
            askAmount(train.Count);

            Console.Write($"Do you want to change light?(y) ");
            char change = Console.ReadLine().ToCharArray().First();

            if (change == 'y')
            {
                Console.Write($"Which one do you want to change?");
                char numberOfLight = Console.ReadLine().ToCharArray().First();
                int  num           = Convert.ToInt32(numberOfLight.ToString());

                train[i].lights[num - 1].isTurnedOn = changeLight(train[i].lights[num - 1].isTurnedOn);
                goto label;
            }
            else
            {
                Console.Write($"Go to the next(n) or previous(p) vagon? ");
                char nextChar = Console.ReadLine().ToCharArray().First();

                if (nextChar == 'n')
                {
                    i = next(train, i);
                    goto label;
                }
                else if (nextChar == 'p')
                {
                    i = previous(train, i);
                    goto label;
                }
            }
        }
Ejemplo n.º 3
0
 public Light()
 {
     isTurnedOn = RandomClass.randomForLight();
 }