Struct advent_of_code_2021::day_4::BingoCard [−][src]
Expand description
This represents the key information to know if a 5 x 5 bingo card has won.
Fields
numbers: HashMap<u8, (usize, usize)>A Map indexing the remaining numbers to their co-ordinates on the grid
rows: [u8; 5]A counter for each row, tracking how many numbers in that row have been removed
columns: [u8; 5]A counter for each column, tracking how many numbers in that column have been removed
Implementations
If the card contains the provided number, remove it from the unmarked numbers, increment the count of marked numbers in the relevant row and column, then if either of these are now 5, the card has won - return true, otherwise return false.
If the number is not on the card, nothing changes, and return false.
The remaining numbers are the keys of the numbers hash map, as marked numbers are removed from the map.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for BingoCard
impl UnwindSafe for BingoCard
Blanket Implementations
Mutably borrows from an owned value. Read more
