pub fn swarm_count(board: &[[Option<Card>; 5]; 4], player: u8) -> u8 {
        let mut swarm: u8 = 0;
        for i in 0..4 {
            for j in 0..5 {
                if board[i][j].is_some() {
                    let card = board[i][j].as_ref().unwrap();
                    if card.name == Unit::Swarm && card.player == player {
                        swarm += 1;
                    }
                }
            }
        }
        // swarm gets a bonus for each ally swarm except self
        if swarm > 0 {
            return swarm - 1;
        } else {
            return swarm;
        }
    }
// returns the count of player owned swarms
returns the count of player owned swarms
returns the count of player owned swarms
pub fn swarm_count(board: &[[Option<Card>; 5]; 4], player: u8) -> u8 {
        let mut swarm: u8 = 0;
        for i in 0..4 {
            for j in 0..5 {
                if board[i][j].is_some() {
                    let card = board[i][j].as_ref().unwrap();
                    if card.name == Unit::Swarm && card.player == player {
                        swarm += 1;
                    }
                }
            }
        }
        // swarm gets a bonus for each ally swarm except self
        if swarm > 0 {
            return swarm - 1;
        } else {
            return swarm;
        }
    }
pub fn swarm_count ( board : & [ [ Option < Card > ; 5 ] ; 4 ] , player : u8 ) -> u8 { let mut swarm : u8 = 0 ; for i in 0 .. 4 { for j in 0 .. 5 { if board [ i ] [ j ] . is_some ( ) { let card = board [ i ] [ j ] . as_ref ( ) . unwrap ( ) ; if card . name == Unit :: Swarm && card . player == player { swarm += 1 ; } } } } // swarm gets a bonus for each ally swarm except self if swarm > 0 { return swarm - 1 ; } else { return swarm ; } }
returns the count of player owned swarms
returns the count of player owned swarms
board
&[[Option<Card>; 5]; 4]
player
u8