// Returns how many troops lost: (attack, defense)
Returns how many troops lost: (attack, defense)
Returns how many troops lost : ( attack defense )
fn roll_all(&mut self, attack_with: u32, defend_with: u32) -> AttackResults {
        let mut attack_losses: u32 = 0;
        let mut defend_losses: u32 = 0;
        while attack_with > attack_losses && defend_with > defend_losses {
            let attackers = std::cmp::min(attack_with - attack_losses, 3);
            let defenders = std::cmp::min(defend_with - defend_losses, 2);
            let losses = self.roll_dice(attackers, defenders);
            attack_losses += losses.attack_dice;
            defend_losses += losses.defend_dice;
        }
        AttackResults { attack_dice: attack_losses, defend_dice: defend_losses }
    }
fn roll_all ( & mut self , attack_with : u32 , defend_with : u32 ) -> AttackResults { let mut attack_losses : u32 = 0 ; let mut defend_losses : u32 = 0 ; while attack_with > attack_losses && defend_with > defend_losses { let attackers = std :: cmp :: min ( attack_with - attack_losses , 3 ) ; let defenders = std :: cmp :: min ( defend_with - defend_losses , 2 ) ; let losses = self . roll_dice ( attackers , defenders ) ; attack_losses += losses . attack_dice ; defend_losses += losses . defend_dice ; } AttackResults { attack_dice : attack_losses , defend_dice : defend_losses } }
Returns how many troops lost: (attack, defense)
Returns how many troops lost : ( attack defense )
&mut self
attack_with
u32
defend_with
u32