Day 3: Testfile works.. answer still wrong :-(

This commit is contained in:
jeremy committed 2023-12-04 03:29:13 +01:00
1 parent 5a814d807f
commit fab6be8091
2 files changed
+5 -1

No files matched your search

+4
View File
@@ -1,10 +1,14 @@
import day1.Day1
import day2.Day2
import day2.Hand
import day3.Day3
fun main() {
println("Day 1-1: ${Day1.answerOne()}")
println("Day 1-2: ${Day1.answerTwo()}")
println("Day 2-1: ${Day2.sumOfCompatibleGames("src/main/resources/day2/input.txt", Hand(12,13,14))}")
println("Day 2-2: ${Day2.powerOfMinimumSetOfCubes("src/main/resources/day2/input.txt")}")
println("Day 3-1: ${Day3.sumOfSelectedParts("src/main/resources/day3/input.txt")}")
}
+1 -1
View File
@@ -48,7 +48,7 @@ data class Part(val number: Int, val from: Coordinate, val to: Coordinate) {
&& y <= to.y
fun isSelected(engine: List<String>) =
engine.hasSymbols(from.x - 1, from.y - 1, to.x - from.x + 2) // above
engine.hasSymbols(from.x - 1, from.y - 1, to.x - from.x + 1 + 2) // above
|| engine.hasSymbols(from.x - 1, from.y + 1, to.x - from.x + 2) // below
|| engine.hasSymbols(from.x - 1, from.y, 1) // left
|| engine.hasSymbols(to.x + 1, from.y, 1) // right