pub fn wincon(&self, universe: &Universe) -> bool {
        match *self {
            Faction::Werewolves => !universe.factions.iter()
                .zip(universe.alive.iter())
                .any(|(&faction, &alive)| faction == Faction::Village && alive),
            Faction::Village => {
                let villager_alive = universe.factions.iter()
                    .zip(universe.alive.iter())
                    .any(|(&faction, &alive)| faction == Faction::Village && alive);
                // if introducing additional factions considered threats to the village, update this
                let threat_alive = universe.factions.iter()
                    .zip(universe.alive.iter())
                    .any(|(&faction, &alive)| faction == Faction::Werewolves && alive);
                villager_alive && !threat_alive
            }
        }
    }
/// Checks whether a faction's win condition has been met in the given universe.
Checks whether a faction's win condition has been met in the given universe.
Checks whether a faction ' s win condition has been met in the given universe .
pub fn wincon(&self, universe: &Universe) -> bool {
        match *self {
            Faction::Werewolves => !universe.factions.iter()
                .zip(universe.alive.iter())
                .any(|(&faction, &alive)| faction == Faction::Village && alive),
            Faction::Village => {
                let villager_alive = universe.factions.iter()
                    .zip(universe.alive.iter())
                    .any(|(&faction, &alive)| faction == Faction::Village && alive);
                // if introducing additional factions considered threats to the village, update this
                let threat_alive = universe.factions.iter()
                    .zip(universe.alive.iter())
                    .any(|(&faction, &alive)| faction == Faction::Werewolves && alive);
                villager_alive && !threat_alive
            }
        }
    }
pub fn wincon ( & self , universe : & Universe ) -> bool { match * self { Faction :: Werewolves => ! universe . factions . iter ( ) . zip ( universe . alive . iter ( ) ) . any ( | ( & faction , & alive ) | faction == Faction :: Village && alive ) , Faction :: Village => { let villager_alive = universe . factions . iter ( ) . zip ( universe . alive . iter ( ) ) . any ( | ( & faction , & alive ) | faction == Faction :: Village && alive ) ; // if introducing additional factions considered threats to the village, update this let threat_alive = universe . factions . iter ( ) . zip ( universe . alive . iter ( ) ) . any ( | ( & faction , & alive ) | faction == Faction :: Werewolves && alive ) ; villager_alive && ! threat_alive } } }
Checks whether a faction's win condition has been met in the given universe.
Checks whether a faction ' s win condition has been met in the given universe .
&self
universe
&Universe
&self
universe
&Universe