Обновить works/lab-01/stage1-extra.kt

так, повспоминал свои дни в питоне... ох уж эти строки... наверняка этот код очень легко ломается
This commit is contained in:
2026-09-24 07:20:02 +00:00
parent 3f6bdc1250
commit ad5e6b4018
@@ -2,7 +2,7 @@ fun main() {
print("Тип карты: ")
val cardType: String = readln().uppercase()
print("Подтип карты: ")
val cardSubtype: String = readln()
val cardSubtype: String = readln().uppercase()
print("Название карты: ")
val cardName: String = readln()
print("Описание основного эффекта: ")
@@ -28,23 +28,69 @@ fun main() {
val spaceLength1: String = " ".repeat(startLength)
val spaceLength2: String = " ".repeat(endLength)
var effectLines: String = ""
val effectDescWords: MutableList<String> = effectText.split(" ").toMutableList()
var i: Int = 0
println("======================================================================")
println("[$cardType] $cardName$spaceLength1[$cardSubtype]")
println("----------------------------------------------------------------------")
print("Эффект: ")
while (effectDescWords.isNotEmpty() && i < 10) {
while ((effectLines.length < 62) && (i < 10)) {
effectLines = effectLines + effectDescWords[0] + " "
effectDescWords.removeAt(0)
i++
// я уверен есть способ попроще, но...
var lines: String = ""
var descWords: MutableList<String> = effectText.split(" ").toMutableList()
var i: Int = 0
while (descWords.isNotEmpty()) {
while (i < 10) {
while ((lines.length < 58) && (i < 10)) {
if (descWords.isEmpty()) {
break
}
else {
lines = lines + descWords[0] + " "
descWords.removeAt(0)
i++
}
}
if (descWords.isEmpty()) {
print("$lines\n")
break
}
else {
print("$lines\n")
}
}
print("$effectLines\n")
lines = " "
i = 0
}
print("Правило: ")
lines = ""
descWords = ruleText.split(" ").toMutableList()
i = 0
while (descWords.isNotEmpty()) {
while (i < 10) {
while ((lines.length < 60) && (i < 10)) {
if (descWords.isEmpty()) {
break
}
else {
lines = lines + descWords[0] + " "
descWords.removeAt(0)
i++
}
}
if (descWords.isEmpty()) {
print("$lines\n")
break
}
else {
print("$lines\n")
}
}
lines = " "
i = 0
}
print("Правило: $ruleText\n") // WIP
println("----------------------------------------------------------------------")
println("Илл. $illustrator$spaceLength2$cardNumber/$totalInSet ★ ")
println("======================================================================")