fn solve_last_winning(mut game: Game, all_draws: Vec<u8>) -> u32 {
    let mut results: Vec<(Vec<Board>, Vec<u8>)> = Vec::new();

    for draw in all_draws.clone() {
        game.draw(draw);

        if let Some(boards) = game.pop_winners() {
            results.push((boards, game.draws.clone()));
        }
    }

    let (last_winners, last_winner_draws) = results.last().unwrap();

    match &last_winners[..] {
        [board] => board.calculate_answer(last_winner_draws),
        _ => panic!("More than one board won first"),
    }
}
/// Solves part 2: Find last winning board. This one looked easy, but got me into a lot of trouble,
/// especially because multiple boards can win at the same time!
Solves part 2: Find last winning board. This one looked easy, but got me into a lot of trouble,
especially because multiple boards can win at the same time!
Solves part 2 : Find last winning board . This one looked easy but got me into a lot of trouble especially because multiple boards can win at the same time!
fn solve_last_winning(mut game: Game, all_draws: Vec<u8>) -> u32 {
    let mut results: Vec<(Vec<Board>, Vec<u8>)> = Vec::new();
    for draw in all_draws.clone() {
        game.draw(draw);
        if let Some(boards) = game.pop_winners() {
            results.push((boards, game.draws.clone()));
        }
    }
    let (last_winners, last_winner_draws) = results.last().unwrap();
    match &last_winners[..] {
        [board] => board.calculate_answer(last_winner_draws),
        _ => panic!("More than one board won first"),
    }
}
fn solve_last_winning ( mut game : Game , all_draws : Vec < u8 > ) -> u32 { let mut results : Vec < ( Vec < Board > , Vec < u8 > ) > = Vec :: new ( ) ; for draw in all_draws . clone ( ) { game . draw ( draw ) ; if let Some ( boards ) = game . pop_winners ( ) { results . push ( ( boards , game . draws . clone ( ) ) ) ; } } let ( last_winners , last_winner_draws ) = results . last ( ) . unwrap ( ) ; match & last_winners [ .. ] { [ board ] => board . calculate_answer ( last_winner_draws ) , _ => panic ! ( " " ) , } }
Solves part 2: Find last winning board.
Solves part 2 : Find last winning board .
game
Game
all_draws
Vec<u8>
game
Game
all_draws
Vec<u8>