Update things
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user