Kotlinでhello world2

コンピュータ
久しぶりにKotlinのことを思い出したので、以前Powershellで作ったhello worldをKotlinで作ってみました。
// hello2

fun main() {
    val data = mapOf(
        "0" to listOf(1,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1),
        "1" to listOf(1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1),
        "2" to listOf(1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1),
        "3" to listOf(1,1,1,0,0,0,0,1,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,1,1,0,0,1,0,0,0,0,0,1),
        "4" to listOf(1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,1,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,1,0,0,0,1,1,0,0,0,0,1,0,0,0,1,1,1),
        "5" to listOf(1,0,0,1,0,0,1,1,1,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,1),
        "6" to listOf(1,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,1,0,1,0,1,0,0,1,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,1),
        "7" to listOf(1,0,0,1,0,0,0,1,1,1,0,0,1,0,0,1,0,0,0,1,1,0,0,2,0,0,0,0,1,0,0,0,1,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,1,1)
    )
    val ON_CHAR = "N"
    val OFF_CHAR = " "
    val NG_CHAR = "*"

    println("")

    for((Key, Value) in data) {
        var line = ""
        for(v in Value) {
            if (v == 0){
                line = line + OFF_CHAR
                continue
            }
            if (v == 1){
                line = line + ON_CHAR
                continue
            }
            line = line + NG_CHAR
        }

        val n = (Key.toInt() + 1).toString().padStart(2, '0')
        println("$n $line")
    }

    println("")

}

コメント