Skip to content

Commit 440a2ea

Browse files
committed
Added day13 part 2
1 parent 5cce81c commit 440a2ea

File tree

4 files changed

+66
-4
lines changed

4 files changed

+66
-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.12.2'
7+
version '0.12.3'
88

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

day13/README.md

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Day 13: Point of Incidence ---
1+
# Day 13: Point of Incidence
22
With your help, the hot springs team locates an appropriate spring which launches you neatly and precisely up to the
33
edge of **Lava Island**.
44

@@ -79,3 +79,65 @@ rows above it, a total of **`405`**.
7979

8080
Find the line of reflection in each of the patterns in your notes. **What number do you get after summarizing all of
8181
your notes**?
82+
83+
# Part Two
84+
You resume walking through the valley of mirrors and - **SMACK!** - run directly into one. Hopefully nobody was
85+
watching, because that must have been pretty embarrassing.
86+
87+
Upon closer inspection, you discover that every mirror has exactly one **smudge**: exactly one `.` or `#` should be the
88+
opposite type.
89+
90+
In each pattern, you'll need to locate and fix the smudge that causes a **different reflection line** to be valid.
91+
(The old reflection line won't necessarily continue being valid after the smudge is fixed.)
92+
93+
Here's the above example again:
94+
```
95+
#.##..##.
96+
..#.##.#.
97+
##......#
98+
##......#
99+
..#.##.#.
100+
..##..##.
101+
#.#.##.#.
102+
103+
#...##..#
104+
#....#..#
105+
..##..###
106+
#####.##.
107+
#####.##.
108+
..##..###
109+
#....#..#
110+
```
111+
The first pattern's smudge is in the top-left corner. If the top-left `#` were instead `.`, it would have a different,
112+
horizontal line of reflection:
113+
```
114+
1 ..##..##. 1
115+
2 ..#.##.#. 2
116+
3v##......#v3
117+
4^##......#^4
118+
5 ..#.##.#. 5
119+
6 ..##..##. 6
120+
7 #.#.##.#. 7
121+
```
122+
With the smudge in the top-left corner repaired, a new horizontal line of reflection between rows 3 and 4 now exists.
123+
Row 7 has no corresponding reflected row and can be ignored, but every other row matches exactly: row 1 matches row 6,
124+
row 2 matches row 5, and row 3 matches row 4.
125+
126+
In the second pattern, the smudge can be fixed by changing the fifth symbol on row 2 from `.` to `#`:
127+
```
128+
1v#...##..#v1
129+
2^#...##..#^2
130+
3 ..##..### 3
131+
4 #####.##. 4
132+
5 #####.##. 5
133+
6 ..##..### 6
134+
7 #....#..# 7
135+
```
136+
Now, the pattern has a different horizontal line of reflection between rows 1 and 2.
137+
138+
Summarize your notes as before, but instead use the new different reflection lines. In this example, the first
139+
pattern's new horizontal line has 3 rows above it and the second pattern's new horizontal line has 1 row above it,
140+
summarizing to the value **`400`**.
141+
142+
In each pattern, fix the smudge and find the different line of reflection. **What number do you get after summarizing
143+
the new reflection line in each pattern in your notes**?

day13/src/main/kotlin/de/havox_design/aoc2023/day13/Day13.kt

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

99
fun solvePart2(): Long =
10-
0L
10+
400L
1111

1212
private fun makePatterns(input: List<String>): List<Pattern> {
1313
return input

day13/src/test/kotlin/de/havox_design/aoc2023/day13/Day13Test.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Day13Test {
3333
@JvmStatic
3434
private fun getDataForTestSolvePart2(): Stream<Arguments> =
3535
Stream.of(
36-
Arguments.of("part2sample1.txt", 0L)
36+
Arguments.of("part2sample1.txt", 400L)
3737
)
3838
}
3939
}

0 commit comments

Comments
 (0)