public static void run() { BusManaging.StartupMessage(); Console.ReadKey(); Console.Clear(); List <string> Passenger = new List <string>(); Random r = new Random(); var NameScraper = new NameScraper(); NameScraper.Start(); var JobScraper = new JobScraper(); JobScraper.Start(); Console.WriteLine("\nWaiting for program to begin..."); System.Threading.Thread.Sleep(2500); Console.Clear(); int StationNumber = 0; do { BusManaging.BusStation(StationNumber); if (Passenger.Count < 25) { Passenger.AddRange(BusManaging.PassengerHandler()); } Console.WriteLine("Passengerlist: "); foreach (var info in Passenger) { Console.WriteLine(info); } for (int i = 0; i < r.Next(0, 15); i++) { int index = 0; int count = 0; if (Passenger.Count > 0) { index = r.Next(0, Passenger.Count - 1); count = 1; } else { index = 0; count = 0; } Passenger.RemoveRange(index, count); } System.Threading.Thread.Sleep(5 * 1000); //Console.ReadKey(); Console.Clear(); if (StationNumber < 11) { StationNumber++; } else { StationNumber = 0; } } while (true); }
public static List <string> PassengerHandler() { List <string> Passenger = new List <string>(); for (int i = 0; i < r.Next(0, 15); i++) { Passenger.Add(BusManaging.GeneratePerson()); } return(Passenger); }