pub fn select_fn(problem: &Problem) -> Box<dyn Fn(Problem) -> Solution> {
    // zero days of rain
    if f64equal(problem.water_0, 0.0) {
        return Box::new(|x| dry(x));
    }

    // flat world profile
    if problem.ground_max == problem.ground_min {
        return Box::new(|x| flat(x));
    }

    // saturation, water level equal to highest land
    if problem.water_tot == problem.saturation_water {
        return Box::new(|x| saturation(x));
    }

    // land is entirely under water
    if problem.water_tot > problem.saturation_water {
        return Box::new(|x| full(x));
    }

    // function for general case
    return Box::new(|x| algorithm::raise(x));
}
// categorise problems to deal with trivial and simple problems
// returns strings as placeholder. Will return function.
categorise problems to deal with trivial and simple problems
returns strings as placeholder. Will return function.
categorise problems to deal with trivial and simple problems returns strings as placeholder . Will return function .
pub fn select_fn(problem: &Problem) -> Box<dyn Fn(Problem) -> Solution> {
    // zero days of rain
    if f64equal(problem.water_0, 0.0) {
        return Box::new(|x| dry(x));
    }
    // flat world profile
    if problem.ground_max == problem.ground_min {
        return Box::new(|x| flat(x));
    }
    // saturation, water level equal to highest land
    if problem.water_tot == problem.saturation_water {
        return Box::new(|x| saturation(x));
    }
    // land is entirely under water
    if problem.water_tot > problem.saturation_water {
        return Box::new(|x| full(x));
    }
    // function for general case
    return Box::new(|x| algorithm::raise(x));
}
pub fn select_fn ( problem : & Problem ) -> Box < dyn Fn ( Problem ) -> Solution > { // zero days of rain if f64equal ( problem . water_0 , 0.0 ) { return Box :: new ( | x | dry ( x ) ) ; } // flat world profile if problem . ground_max == problem . ground_min { return Box :: new ( | x | flat ( x ) ) ; } // saturation, water level equal to highest land if problem . water_tot == problem . saturation_water { return Box :: new ( | x | saturation ( x ) ) ; } // land is entirely under water if problem . water_tot > problem . saturation_water { return Box :: new ( | x | full ( x ) ) ; } // function for general case return Box :: new ( | x | algorithm :: raise ( x ) ) ; }
categorise problems to deal with trivial and simple problems
returns strings as placeholder.
categorise problems to deal with trivial and simple problems returns strings as placeholder .
problem
&Problem
problem
&Problem