/// <summary>
 /// Gets whether the kerbal is available for assignment.
 /// </summary>
 /// <param name="crew"></param>
 /// <returns></returns>
 private static bool IsAssignable(ProtoCrewMember crew, CrewableList alreadyAssigned)
 {
     return((crew != null) &&
            (crew.type == ProtoCrewMember.KerbalType.Crew) && // we never want to assign tourists
            (crew.rosterStatus == ProtoCrewMember.RosterStatus.Available) &&
            !alreadyAssigned.IsAssigned(crew));
 }
 /// <summary>
 /// Find the highest and lowest level kerbal of the specified profession that's available for assignment.
 /// Returns true if found, false if not.
 /// </summary>
 private static bool FindHighestLowestAvailable(
     string profession,
     int minimumLevel,
     CrewableList alreadyAssigned,
     out ProtoCrewMember highest,
     out ProtoCrewMember lowest)
 {
     highest = null;
     lowest  = null;
     foreach (ProtoCrewMember candidate in Roster.Crew)
     {
         if (IsAssignable(candidate, alreadyAssigned) &&
             profession.Equals(candidate.trait) &&
             (candidate.experienceLevel >= minimumLevel) &&
             !alreadyAssigned.IsAssigned(candidate))
         {
             if ((highest == null) || (candidate.experience > highest.experience))
             {
                 highest = candidate;
             }
             if ((lowest == null) || (candidate.experience > lowest.experience))
             {
                 lowest = candidate;
             }
         }
     }
     return(highest != null);
 }