1
0

Update things

This commit is contained in:
2021-12-01 19:32:38 +01:00
parent ccfcf5a259
commit 322f8eb45a
53 changed files with 156 additions and 239 deletions
+2 -3
View File
@@ -1,7 +1,6 @@
package be.vandewalleh.aoc.days
import be.vandewalleh.aoc.utils.input.Day
import be.vandewalleh.aoc.utils.input.Input
import be.vandewalleh.aoc.utils.input.Lines
private data class Point(val x: Int, val y: Int, val z: Int)
@@ -10,7 +9,7 @@ private data class Point4(val x: Int, val y: Int, val z: Int, val blah: Int)
private enum class State { Active, Inactive }
@Day(17)
class Day17(@Lines val input: Input<List<String>>) {
class Day17(@Lines val input: List<String>) {
fun part1(): Int {
val grid = parseGrid { x, y -> Point(x, y, 0) }
@@ -26,7 +25,7 @@ class Day17(@Lines val input: Input<List<String>>) {
private fun <T> parseGrid(pointFactory: (x: Int, y: Int) -> T): MutableMap<T, State> {
val grid = mutableMapOf<T, State>()
input.value.forEachIndexed { index, row ->
input.forEachIndexed { index, row ->
row.forEachIndexed { col, char ->
val state = if (char == '#') State.Active else State.Inactive
grid[pointFactory(index, col)] = state