1
1
package com .sbaars .adventofcode .year22 .days ;
2
2
3
- import com .sbaars .adventofcode .common .Day ;
4
3
import com .sbaars .adventofcode .common .Direction ;
5
4
import com .sbaars .adventofcode .common .grid .NumGrid ;
6
5
import com .sbaars .adventofcode .year22 .Day2022 ;
@@ -15,13 +14,7 @@ public Day8() {
15
14
}
16
15
17
16
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 ();
25
18
}
26
19
27
20
@ Override
@@ -45,6 +38,12 @@ private boolean findEdge(NumGrid grid, Point p) {
45
38
return false ;
46
39
}
47
40
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
+
48
47
private long scenicScore (NumGrid grid , Point p ) {
49
48
Direction [] dirs = Direction .fourDirections ();
50
49
long num = grid .get (p );
@@ -63,11 +62,4 @@ private long scenicScore(NumGrid grid, Point p) {
63
62
}
64
63
return score ;
65
64
}
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
- }
73
65
}
0 commit comments