File tree Expand file tree Collapse file tree 2 files changed +10
-19
lines changed
main/java/com/github/saser/adventofcode/year2016/day18
test/java/com/github/saser/adventofcode/year2016/day18 Expand file tree Collapse file tree 2 files changed +10
-19
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ private static Result solve(Reader r, int part) {
19
19
var state = Day18 .parse (r );
20
20
var states = Stream .iterate (state , Day18 ::next );
21
21
var sum = states
22
- .limit (40 )
22
+ .limit (part == 1 ? 40 : 400000 )
23
23
.mapToInt (Day18 ::count )
24
24
.sum ();
25
25
return Result .ok (Integer .toString (sum ));
Original file line number Diff line number Diff line change @@ -17,22 +17,13 @@ public void part1Actual() throws IOException {
17
17
}
18
18
}
19
19
20
- // @Test
21
- // public void part2Example() {
22
- // var input = new StringReader("");
23
- // var output = "";
24
- // var result = Day18.part2(input);
25
- // Assert.assertEquals("no error", "", result.error);
26
- // Assert.assertEquals("correct output", output, result.answer);
27
- // }
28
-
29
- // @Test
30
- // public void part2Actual() throws IOException {
31
- // try (var input = new FileReader("inputs/2016/18")) {
32
- // var output = "";
33
- // var result = Day18.part2(input);
34
- // Assert.assertEquals("no error", "", result.error);
35
- // Assert.assertEquals("correct output", output, result.answer);
36
- // }
37
- // }
20
+ @ Test
21
+ public void part2Actual () throws IOException {
22
+ try (var input = new FileReader ("inputs/2016/18" )) {
23
+ var output = "19998750" ;
24
+ var result = Day18 .part2 (input );
25
+ Assert .assertEquals ("no error" , "" , result .error );
26
+ Assert .assertEquals ("correct output" , output , result .answer );
27
+ }
28
+ }
38
29
}
You can’t perform that action at this time.
0 commit comments