extern crate crossterm;

use crossterm::style::{
    Colorize,
    Styler
};

use crate::evolearn::Population;

use super::Evolver;

impl Evolver {
    /// Shows statistics.
    pub fn stat(&self) -> Result<(), String> {
        let stats = self.population.stats();
        println!("{}", "Statistics:".dark_magenta().bold());
        println!("{} {} = {}{} = {:.3}{} = {}",
            "Age:".dark_yellow().bold(),
            "min".magenta(), stats.age.0,
            ", average".magenta(), stats.age.1,
            ", max".magenta(), stats.age.2
        );
        Ok(())
    }

}
