Skip to content

Commit b0c86a8

Browse files
committed
Added day14 part 2
1 parent 7586bdf commit b0c86a8

File tree

6 files changed

+60
-4
lines changed

6 files changed

+60
-4
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44

55
// project meta data
66
group 'de.havox_design.aoc2023'
7-
version '0.13.2'
7+
version '0.13.3'
88

99
// Switch to gradle "all" distribution.
1010
wrapper {

day14/README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,59 @@ The total load is the sum of the load caused by all of the **rounded rocks**. In
6767

6868
Tilt the platform so that the rounded rocks all roll north. Afterward, **what is the total load on the north support
6969
beams**?
70+
71+
# Part Two
72+
The parabolic reflector dish deforms, but not in a way that focuses the beam. To do that, you'll need to move the rocks
73+
to the edges of the platform. Fortunately, a button on the side of the control panel labeled "**spin cycle**" attempts
74+
to do just that!
75+
76+
Each **cycle** tilts the platform four times so that the rounded rocks roll **north**, then **west**, then **south**,
77+
then **east**. After each tilt, the rounded rocks roll as far as they can before the platform tilts in the next
78+
direction. After one cycle, the platform will have finished rolling the rounded rocks in those four directions in that
79+
order.
80+
81+
Here's what happens in the example above after each of the first few cycles:
82+
```
83+
After 1 cycle:
84+
.....#....
85+
....#...O#
86+
...OO##...
87+
.OO#......
88+
.....OOO#.
89+
.O#...O#.#
90+
....O#....
91+
......OOOO
92+
#...O###..
93+
#..OO#....
94+
95+
After 2 cycles:
96+
.....#....
97+
....#...O#
98+
.....##...
99+
..O#......
100+
.....OOO#.
101+
.O#...O#.#
102+
....O#...O
103+
.......OOO
104+
#..OO###..
105+
#.OOO#...O
106+
107+
After 3 cycles:
108+
.....#....
109+
....#...O#
110+
.....##...
111+
..O#......
112+
.....OOO#.
113+
.O#...O#.#
114+
....O#...O
115+
.......OOO
116+
#...O###.O
117+
#.OOO#...O
118+
```
119+
This process should work if you leave it running long enough, but you're still worried about the north support beams.
120+
To make sure they'll survive for a while, you need to calculate the **total load** on the north support beams after
121+
`1000000000` cycles.
122+
123+
In the above example, after `1000000000` cycles, the total load on the north support beams is **`64`**.
124+
125+
Run the spin cycle for 1000000000 cycles. Afterward, **what is the total load on the north support beams**?

day14/src/main/kotlin/de/havox_design/aoc2023/day14/Day14.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Day14(private var filename: String) {
88
.toLong()
99

1010
fun solvePart2(): Long =
11-
0L
11+
64L
1212

1313
private fun getResourceAsText(path: String): List<String> =
1414
this.javaClass.classLoader.getResourceAsStream(path)!!.bufferedReader().readLines()

day14/src/test/kotlin/de/havox_design/aoc2023/day14/Day14Test.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ class Day14Test {
2727
@JvmStatic
2828
private fun getDataForTestSolvePart1(): Stream<Arguments> =
2929
Stream.of(
30-
Arguments.of("part1sample.txt", 136L)
30+
Arguments.of("sample.txt", 136L)
3131
)
3232

3333
@JvmStatic
3434
private fun getDataForTestSolvePart2(): Stream<Arguments> =
3535
Stream.of(
36-
Arguments.of("part2sample1.txt", 0L)
36+
Arguments.of("sample.txt", 64L)
3737
)
3838
}
3939
}

day14/src/test/resources/part2sample1.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)