Example #1
0
        public static void Main(string[] args)
        {
            int amount = GetFloorsAmount();
            var e1     = new Elevator(0, amount - 1, 0);
            var e2     = new Elevator(0, amount - 1, amount - 1);

            People = GeneratePeople(amount, new [] { e1, e2 });

            while (Hour < CloseHour)
            {
                e1.Move();
                e2.Move();
                Minute += Step;
                Hour   += Minute / 60;
                Minute %= 60;
            }

            for (int i = OpenHour; i < CloseHour; i++)
            {
                Console.WriteLine($"{i:00}:00-{i + 1:00}:00 : {Statistics[i]}");
            }
            Console.WriteLine($"Max wait time: {MaxWaitTime / 60:00}:{MaxWaitTime % 60:00}");
        }
Example #2
0
 public static void OnBoard(Person p, Elevator e)
 {
     People.Remove(p);
     p.Board -= OnBoard;
 }