This commit is contained in:
2018-12-17 14:03:08 +01:00
parent 6a23bbad3b
commit 6f67ea2b0c

View File

@@ -36,13 +36,16 @@ fn main() {
let width = coordinates let width = coordinates
.iter() .iter()
.map(|(x, _)| *x as usize) .map(|(x, _)| *x as usize)
.max().expect("failed to find max x") + 1; .max()
.expect("failed to find max x")
+ 1;
let height = coordinates let height = coordinates
.iter() .iter()
.map(|(_, y)| *y as usize) .map(|(_, y)| *y as usize)
.max() .max()
.expect("failed to find max y") + 1; .expect("failed to find max y")
+ 1;
let mut grid_view = vec![State::Empty; width * height].into_boxed_slice(); let mut grid_view = vec![State::Empty; width * height].into_boxed_slice();
@@ -84,10 +87,12 @@ fn main() {
let (_, area) = areas let (_, area) = areas
.iter() .iter()
.filter_map(|(i, area)| if let Area::Finite(area) = area { .filter_map(|(i, area)| {
if let Area::Finite(area) = area {
Some((i, area)) Some((i, area))
} else { } else {
None None
}
}) })
.max_by_key(|(_, area)| *area) .max_by_key(|(_, area)| *area)
.expect("failed to find max area"); .expect("failed to find max area");