Update things
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
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
|
||||
|
||||
@Day(2)
|
||||
class Day02(@Lines input: Input<List<String>>) {
|
||||
class Day02(@Lines input: List<String>) {
|
||||
private data class PasswordEntry(val range: IntRange, val letter: Char, val password: String)
|
||||
|
||||
private val regex = "^(\\d+)-(\\d+) ([a-z]): (.*)$".toRegex()
|
||||
|
||||
private val passwords = input.value.map {
|
||||
private val passwords = input.map {
|
||||
val (_, min, max, letter, password) = regex.find(it)!!.groupValues
|
||||
PasswordEntry(min.toInt()..max.toInt(), letter[0], password)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user