fn step_notes(note_set: &[Frac], memory: &Memory) -> Vec<Frac> {
    let mut best: Vec<Frac> = note_set.to_owned();
    let mut best_score = 1_f64;
    for i in 0..note_set.len() {
        for a in 1..12 {
            for b in 1..12 {
                let possibility = simplify(Frac(a, b));
                if (note_set.contains(&possibility)) {
                    continue;
                }
                let note_set2: Vec<Frac> = note_set[0..i].iter()
                                                         .chain(note_set[i+1..note_set.len()].iter())
                                                         .chain([possibility].iter())
                                                         .map(|n| n.clone())
                                                         .collect();
                let score = judge(&note_set2, memory);
                if score < best_score {
                    best = note_set2;
                    best_score = score;
                }
            }
        }
    }

    best
}
/// step to a set of notes that minimizes the judge function.
step to a set of notes that minimizes the judge function.
step to a set of notes that minimizes the judge function .
fn step_notes(note_set: &[Frac], memory: &Memory) -> Vec<Frac> {
    let mut best: Vec<Frac> = note_set.to_owned();
    let mut best_score = 1_f64;
    for i in 0..note_set.len() {
        for a in 1..12 {
            for b in 1..12 {
                let possibility = simplify(Frac(a, b));
                if (note_set.contains(&possibility)) {
                    continue;
                }
                let note_set2: Vec<Frac> = note_set[0..i].iter()
                                                         .chain(note_set[i+1..note_set.len()].iter())
                                                         .chain([possibility].iter())
                                                         .map(|n| n.clone())
                                                         .collect();
                let score = judge(&note_set2, memory);
                if score < best_score {
                    best = note_set2;
                    best_score = score;
                }
            }
        }
    }
    best
}
fn step_notes ( note_set : & [ Frac ] , memory : & Memory ) -> Vec < Frac > { let mut best : Vec < Frac > = note_set . to_owned ( ) ; let mut best_score = 1_f64 ; for i in 0 .. note_set . len ( ) { for a in 1 .. 12 { for b in 1 .. 12 { let possibility = simplify ( Frac ( a , b ) ) ; if ( note_set . contains ( & possibility ) ) { continue ; } let note_set2 : Vec < Frac > = note_set [ 0 .. i ] . iter ( ) . chain ( note_set [ i + 1 .. note_set . len ( ) ] . iter ( ) ) . chain ( [ possibility ] . iter ( ) ) . map ( | n | n . clone ( ) ) . collect ( ) ; let score = judge ( & note_set2 , memory ) ; if score < best_score { best = note_set2 ; best_score = score ; } } } } best }
step to a set of notes that minimizes the judge function.
step to a set of notes that minimizes the judge function .
note_set
&[Frac]
memory
&Memory
note_set
&[Frac]
memory
&Memory