/// For each of the 52 possible cards, this function counts how many instances of this card exist.
For each of the 52 possible cards, this function counts how many instances of this card exist.
For each of the 52 possible cards this function counts how many instances of this card exist .
fn count_cards(game_state: &GameState) -> [i32; 52] {
    let mut card_count = [0; 52];
    for cascade in game_state.cascades.iter() {
        for &card in cascade.0.iter() {
            card_count[card_index(card)] += 1;
        }
    }
    for foundation in game_state.foundations.0.iter() {
        for &card in foundation {
            card_count[card_index(card)] += 1;
        }
    }
    for &some_card in game_state.freecells.iter() {
        if let Some(card) = some_card {
            card_count[card_index(card)] += 1;
        }
    }
    card_count
}
fn count_cards ( game_state : & GameState ) -> [ i32 ; 52 ] { let mut card_count = [ 0 ; 52 ] ; for cascade in game_state . cascades . iter ( ) { for & card in cascade . 0 . iter ( ) { card_count [ card_index ( card ) ] += 1 ; } } for foundation in game_state . foundations . 0 . iter ( ) { for & card in foundation { card_count [ card_index ( card ) ] += 1 ; } } for & some_card in game_state . freecells . iter ( ) { if let Some ( card ) = some_card { card_count [ card_index ( card ) ] += 1 ; } } card_count }
For each of the 52 possible cards, this function counts how many instances of this card exist.
For each of the 52 possible cards this function counts how many instances of this card exist .
game_state
&GameState