pub const PARTS: [&str; 6] = ["env", "clo", "head", "mouth", "eyes", "top"];
const SCALE: f64 = 47.0 / 100.0;
pub fn map(hash12: &str) -> Vec<(String, i32)> {
PARTS
.iter()
.enumerate()
.map(|(i, part)| ((*part).to_string(), map_to47(two_digits(hash12, i * 2))))
.collect()
}
fn map_to47(two_digits: i32) -> i32 {
(SCALE * f64::from(two_digits)).round() as i32
}
fn two_digits(hash: &str, idx: usize) -> i32 {
let bytes = hash.as_bytes();
if idx + 2 > bytes.len() {
return 0;
}
(bytes[idx] - b'0') as i32 * 10 + (bytes[idx + 1] - b'0') as i32
}