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
.iter()
.map(|(x, _)| *x as usize)
.max().expect("failed to find max x") + 1;
.max()
.expect("failed to find max x")
+ 1;
let height = coordinates
.iter()
.map(|(_, y)| *y as usize)
.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();
@@ -84,10 +87,12 @@ fn main() {
let (_, area) = areas
.iter()
.filter_map(|(i, area)| if let Area::Finite(area) = area {
.filter_map(|(i, area)| {
if let Area::Finite(area) = area {
Some((i, area))
} else {
None
}
})
.max_by_key(|(_, area)| *area)
.expect("failed to find max area");