projects
/
advent_of_code_2024.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ac2b6a4
)
Simplify day 08 (2)
author
Greg Burri
<greg.burri@gmail.com>
Sun, 8 Dec 2024 17:04:29 +0000
(18:04 +0100)
committer
Greg Burri
<greg.burri@gmail.com>
Sun, 8 Dec 2024 17:04:29 +0000
(18:04 +0100)
src/day08.rs
patch
|
blob
|
history
diff --git
a/src/day08.rs
b/src/day08.rs
index
1aec6bd
..
73a945d
100644
(file)
--- a/
src/day08.rs
+++ b/
src/day08.rs
@@
-54,12
+54,10
@@
fn antinode_positions(
let mut antinodes = Vec::new();
match mode {
AntinodeMode::TwoPerPair => {
- let (a1, a2) = ((p1x + dx, p1y + dy), (p2x - dx, p2y - dy));
- if inside(a1, limits) {
- antinodes.push(a1);
- }
- if inside(a2, limits) {
- antinodes.push(a2);
+ for p in [(p1x + dx, p1y + dy), (p2x - dx, p2y - dy)] {
+ if inside(p, limits) {
+ antinodes.push(p);
+ }
}
}
AntinodeMode::Unlimited => {