Untitled
unknown
plain_text
10 months ago
885 B
3
Indexable
package aoc2016
import java.io.File
interface IReceiver {}
class Robot(val index: Int) : IReceiver {
private lateinit var lowReceiver: IReceiver
private lateinit var highReceiver: IReceiver
}
class Output(val index: Int) : IReceiver {
}
class ReceiverMap {
fun getBot(index: Int): Robot {
return botMap.getOrPut(index) { Robot(index) }
}
fun getOutput(index: Int): Output {
return outputMap.getOrPut(index) { Output(index) }
}
private val botMap = hashMapOf<Int, Robot>()
private val outputMap = hashMapOf<Int, Output>()
}
fun main() {
val receiverMap = ReceiverMap()
val valueRegex = Regex("value (\\d+) goes to bot (\\d+)")
val giveRegex = Regex("bot (\\d+) gives low to (\\w+) (\\d+) and high to (\\w+) (\\d+)")
File("input/2016/day10.in").forEachLine { line ->
}
}Editor is loading...
Leave a Comment