pokestat 0.1.1

guess a pokemon's IVs and EVs from in-game information
Documentation
//! given a set of stats of a pokemon, figure out a possible spread of EVs/IVs

use pokestat::*;

const USAGE: &str = "
Usage: pokestat POKEMON LEVEL NATURE HP ATK DEF SPA SPD SPE
";

fn main() -> Result<(), Box<dyn std::error::Error>> {
	let args: Vec<String> = std::env::args().skip(1).collect();
	if args.len() != 9 {
		eprintln!("{}", USAGE);
		std::process::exit(2);
	}
	let spread = Spread::from_summary(
		&args[0], args[1].parse()?, args[2].parse()?,
		&Stats([args[3].parse()?, args[4].parse()?, args[5].parse()?,
				args[6].parse()?, args[7].parse()?, args[8].parse()?]))?;
	println!("{}", &args[0]);
	println!("{spread}");
	if spread.ev.total() > 512 {
		eprintln!("WARNING: more than 512 EVs!");
	}
	assert!(spread.iv.0.iter().max().unwrap() <= &31);
	Ok(())
}