pub fn renumber_genome(genome: &Genome, max_number_neurons: u16) -> Genome {
    let mut new_genome = Vec::with_capacity(genome.len());
    for gene in genome.iter() {
        let mut conn: Gene = gene.clone();

        let new_source = if conn.get_source_type() == NEURON {
            conn.get_source_num() % max_number_neurons as u8
        } else {
            conn.get_source_num() % ENABLED_SENSORS.len() as u8
        };
        conn.set_source_num(new_source);

        let new_sink = if conn.get_sink_type() == NEURON {
            conn.get_sink_num() % max_number_neurons as u8
        } else {
            conn.get_sink_num() % ENABLED_ACTIONS.len() as u8
        };
        conn.set_sink_num(new_sink);
        new_genome.push(conn);
    }

    return new_genome;
}
// Renumbers the genome to the range 0..p.max_number_neurons so that the wiring can be made
// to create the neural net.
Renumbers the genome to the range 0..p.max_number_neurons so that the wiring can be made
to create the neural net.
Renumbers the genome to the range 0 .. p . max_number_neurons so that the wiring can be made to create the neural net .
pub fn renumber_genome(genome: &Genome, max_number_neurons: u16) -> Genome {
    let mut new_genome = Vec::with_capacity(genome.len());
    for gene in genome.iter() {
        let mut conn: Gene = gene.clone();
        let new_source = if conn.get_source_type() == NEURON {
            conn.get_source_num() % max_number_neurons as u8
        } else {
            conn.get_source_num() % ENABLED_SENSORS.len() as u8
        };
        conn.set_source_num(new_source);
        let new_sink = if conn.get_sink_type() == NEURON {
            conn.get_sink_num() % max_number_neurons as u8
        } else {
            conn.get_sink_num() % ENABLED_ACTIONS.len() as u8
        };
        conn.set_sink_num(new_sink);
        new_genome.push(conn);
    }
    return new_genome;
}
pub fn renumber_genome ( genome : & Genome , max_number_neurons : u16 ) -> Genome { let mut new_genome = Vec :: with_capacity ( genome . len ( ) ) ; for gene in genome . iter ( ) { let mut conn : Gene = gene . clone ( ) ; let new_source = if conn . get_source_type ( ) == NEURON { conn . get_source_num ( ) % max_number_neurons as u8 } else { conn . get_source_num ( ) % ENABLED_SENSORS . len ( ) as u8 } ; conn . set_source_num ( new_source ) ; let new_sink = if conn . get_sink_type ( ) == NEURON { conn . get_sink_num ( ) % max_number_neurons as u8 } else { conn . get_sink_num ( ) % ENABLED_ACTIONS . len ( ) as u8 } ; conn . set_sink_num ( new_sink ) ; new_genome . push ( conn ) ; } return new_genome ; }
Renumbers the genome to the range 0..p.max_number_neurons so that the wiring can be made
to create the neural net.
Renumbers the genome to the range 0 .. p . max_number_neurons so that the wiring can be made to create the neural net .
genome
&Genome
max_number_neurons
u16