//! Example of scripted usage

extern crate boolnetevo;

use std::process;

use boolnetevo::{
    BitransformRegister,
    Evolver
};

fn app() -> Result<(), String> {
    let register = BitransformRegister::new_default();
    let mut evolver = Evolver::new_default(&register)?;

    evolver.bitran(&register, "InvSha1", &[1, 4])?;
    evolver.arch(2, 240, 10, 2, 1)?;
    evolver.par("mutat_prob", "0.2")?;
    evolver.evol(100)?;
    evolver.par("mutat_prob", "0.1")?;
    evolver.evol(50)?;
    evolver.save("evolvers/invsha1-demo")?;

    Ok(())
}

fn main() {
    process::exit(match app() {
        Ok(..) => 0,
        Err(s) => {
            eprintln!("Error: {}", s);
            1
        }
    });
}
