public void Leave()
 {
     while (_running)
     {
         int side1 = _timeToGo;
         int side2 = _timeToGo;
         lock (_monitor)
         {
             Thread.Sleep(600);
             Monitor.PulseAll(_monitor);
         }
         while (side1 > 0 && side2 > 0)
         {
             if (_type == "Vertical")
             {
                 if (_queueOfCars.QueueLenght(1) > 0)
                 {
                     var vehicle1 = _queueOfCars.RemoveFromQueue(1);
                     side1 -= vehicle1.GetSpeed();
                     AddAmount(vehicle1);
                 }
                 if (_queueOfCars.QueueLenght(2) > 0)
                 {
                     var vehicle2 = _queueOfCars.RemoveFromQueue(2);
                     side2 -= vehicle2.GetSpeed();
                     AddAmount(vehicle2);
                 }
                 if (_queueOfCars.QueueLenght(1) == 0 && _queueOfCars.QueueLenght(2) == 0)
                 {
                     break;
                 }
             }
             else
             {
                 if (_queueOfCars.QueueLenght(3) > 0)
                 {
                     var vehicle1 = _queueOfCars.RemoveFromQueue(3);
                     side1 -= vehicle1.GetSpeed();
                     AddAmount(vehicle1);
                 }
                 if (_queueOfCars.QueueLenght(4) > 0)
                 {
                     var vehicle2 = _queueOfCars.RemoveFromQueue(4);
                     side2 -= vehicle2.GetSpeed();
                     AddAmount(vehicle2);
                 }
                 if (_queueOfCars.QueueLenght(3) == 0 && _queueOfCars.QueueLenght(4) == 0)
                 {
                     break;
                 }
             }
         }
     }
 }
        public void Arrive()
        {
            var choosing = new Random();

            while (_running)
            {
                int chosenQueue = choosing.Next(1, 5);
                if (_queueOfCars.QueueLenght(chosenQueue) < 20)
                {
                    _queueOfCars.AddToQueue(this, chosenQueue);
                }
                Thread.Sleep(_speed * 100);
                if (_speed == 1)
                {
                    Thread.Sleep(300);
                }
            }
        }