private bool FindBestRides(Vehicle vehicle) { AvailableRides = AvailableRides.Where(x => !x.IsPickedUp).ToList(); if (AvailableRides.Count() <= 0 || AvailableRides.Min(x => x.GetDistance()) > Math.Abs(vehicle.CurrentSteps - MaxStep)) { return(false); } if (vehicle.CurrentSteps >= MaxStep) { return(true); } var bestRide = FindMin(AvailableRides, vehicle); bestRide.IsPickedUp = true; vehicle.CurrentSteps += (bestRide.EarliestStart - vehicle.CurrentSteps) > 0 ? (bestRide.EarliestStart - vehicle.CurrentSteps) : 0; vehicle.CurrentSteps += bestRide.GetDistance(); vehicle.Route.Push(bestRide); return(true); }