Skip to content

Commit a0c2a02

Browse files
committed
Day 8 Restructuring
1 parent 07a57ef commit a0c2a02

File tree

1 file changed

+7
-15
lines changed
  • src/main/java/com/sbaars/adventofcode/year22/days

1 file changed

+7
-15
lines changed

src/main/java/com/sbaars/adventofcode/year22/days/Day8.java

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.sbaars.adventofcode.year22.days;
22

3-
import com.sbaars.adventofcode.common.Day;
43
import com.sbaars.adventofcode.common.Direction;
54
import com.sbaars.adventofcode.common.grid.NumGrid;
65
import com.sbaars.adventofcode.year22.Day2022;
@@ -15,13 +14,7 @@ public Day8() {
1514
}
1615

1716
public static void main(String[] args) throws IOException {
18-
Day d = new Day8();
19-
// d.downloadIfNotDownloaded();
20-
// d.downloadExample();
21-
d.printParts();
22-
// System.in.read();
23-
// d.submitPart1();
24-
// d.submitPart2();
17+
new Day8().printParts();
2518
}
2619

2720
@Override
@@ -45,6 +38,12 @@ private boolean findEdge(NumGrid grid, Point p) {
4538
return false;
4639
}
4740

41+
@Override
42+
public Object part2() {
43+
NumGrid grid = new NumGrid(day(), "\n", "");
44+
return grid.stream().mapToLong(p -> scenicScore(grid, p)).max().getAsLong();
45+
}
46+
4847
private long scenicScore(NumGrid grid, Point p) {
4948
Direction[] dirs = Direction.fourDirections();
5049
long num = grid.get(p);
@@ -63,11 +62,4 @@ private long scenicScore(NumGrid grid, Point p) {
6362
}
6463
return score;
6564
}
66-
67-
68-
@Override
69-
public Object part2() {
70-
NumGrid grid = new NumGrid(day(), "\n", "");
71-
return grid.stream().mapToLong(p -> scenicScore(grid, p)).max().getAsLong();
72-
}
7365
}

0 commit comments

Comments
 (0)