git://code.worthe-it.co.za
/
advent-of-code-2018.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0f849e3
)
More targeted dedup on day 20
author
Justin Worthe
<justin@worthe-it.co.za>
Thu, 20 Dec 2018 06:11:41 +0000
(08:11 +0200)
committer
Justin Worthe
<justin@worthe-it.co.za>
Thu, 20 Dec 2018 06:11:41 +0000
(08:11 +0200)
src/bin/day_20.rs
patch
|
blob
|
history
diff --git
a/src/bin/day_20.rs
b/src/bin/day_20.rs
index
b9706d5
..
6486d72
100644
(file)
--- a/
src/bin/day_20.rs
+++ b/
src/bin/day_20.rs
@@
-49,8
+49,6
@@
fn populate_rooms(input: &str) -> HashMap<(i32, i32), Room> {
let mut coord_stack: Vec<(Vec<(i32, i32)>, Vec<(i32, i32)>)> = Vec::new();
for c in input.chars() {
- coords.sort();
- coords.dedup();
match c {
'^' | '$' => {},
'E' => {
@@
-91,6
+89,8
@@
fn populate_rooms(input: &str) -> HashMap<(i32, i32), Room> {
')' => {
coord_stack.last_mut().unwrap().1.append(&mut coords);
coords = coord_stack.pop().unwrap().1;
+ coords.sort();
+ coords.dedup();
},
c => {
panic!("Unknown character {}", c);