|
|
@ -13,10 +13,9 @@ fn main() {
|
|
|
|
loop {
|
|
|
|
loop {
|
|
|
|
let mut bob = get_bob();
|
|
|
|
let mut bob = get_bob();
|
|
|
|
|
|
|
|
|
|
|
|
let mut drub = get_drub();
|
|
|
|
let mut drubs = (0..2).map(|_| get_drub()).collect::<Vec<_>>();
|
|
|
|
let mut drub2 = get_drub();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if let Some(turns) = make_them_fight(vec![&mut bob], vec![&mut drub, &mut drub2]) {
|
|
|
|
if let Some(turns) = make_them_fight(vec![&mut bob], drubs.iter_mut().collect()) {
|
|
|
|
battles += 1.0;
|
|
|
|
battles += 1.0;
|
|
|
|
total_turns += turns as f64;
|
|
|
|
total_turns += turns as f64;
|
|
|
|
|
|
|
|
|
|
|
@ -28,7 +27,7 @@ fn main() {
|
|
|
|
println!("Drub died in {} turns.", turns)
|
|
|
|
println!("Drub died in {} turns.", turns)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (a * b) / (f64::powi(a + b, 2) * (a + b + 1.0)) <= 0.00001 {
|
|
|
|
if (a * b) / (f64::powi(a + b, 2) * (a + b + 1.0)) <= 0.0001 {
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|