/// <summary> /// Sort connection genes into ascending order by their innovation IDs. /// /// Sorts the non-protected connections in the active module. The /// protected connections are sorted by construction, and we do not want /// to interfere with older modules. /// </summary> public void SortByInnovationId() { // Fist we get only the active part in a new List. ConnectionGeneList littleList = new ConnectionGeneList(Count - _firstActiveIndex); for (int i = _firstActiveIndex; i < Count; ++i) { littleList.Add(this[i]); } // Now we sort only the active part... littleList.Sort(__connectionGeneComparer); // And we copy back these values. int small_indx = 0; for (int i = _firstActiveIndex; i < Count; ++i) { this[i] = littleList[small_indx]; ++small_indx; } }