From 8c265aca89b7e64881f95d086663794aac6efdde Mon Sep 17 00:00:00 2001 From: fan111 Date: Sun, 11 Oct 2026 17:09:57 +0300 Subject: [PATCH] file add --- works/lab-01/src/kotlin 4.2/.gitignore | 32 +++++++++++++++++++++ works/lab-01/src/kotlin 4.2/src/Main.kt | 37 +++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 works/lab-01/src/kotlin 4.2/.gitignore create mode 100644 works/lab-01/src/kotlin 4.2/src/Main.kt diff --git a/works/lab-01/src/kotlin 4.2/.gitignore b/works/lab-01/src/kotlin 4.2/.gitignore new file mode 100644 index 0000000..3ddbf4c --- /dev/null +++ b/works/lab-01/src/kotlin 4.2/.gitignore @@ -0,0 +1,32 @@ +### IntelliJ IDEA ### +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Kotlin ### +.kotlin + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/works/lab-01/src/kotlin 4.2/src/Main.kt b/works/lab-01/src/kotlin 4.2/src/Main.kt new file mode 100644 index 0000000..7f111cb --- /dev/null +++ b/works/lab-01/src/kotlin 4.2/src/Main.kt @@ -0,0 +1,37 @@ +fun main () { + println (" количество карт") + var cardsInBooster = readln().toInt() + val totalCardsInBooster = cardsInBooster + for (cardsInBooster in 1..totalCardsInBooster){ + println("[БУСТЕР] Распакована карта № $cardsInBooster из $totalCardsInBooster") + } + println("полученно карт $totalCardsInBooster, \n") + var energyCard = 10 + for (energy in 10 downTo 0 step 2){ + if (energy > 0){ + val remaining = energy - 2 + println("[РАСПРЕДЕЛЕНИЕ] Передано 2 энергии. В запасе осталось: $remaining") + } + } + println ("[КОНЕЦ] Запас энергии исчерпан, \n") + println("Задайте лимит броксков: ") + val maxFlips = readln().toInt() + for (Flip in 1.. maxFlips){ + println("Бросок № $Flip: 0 - орёл, 1 - решка") + var result = readln().toInt() + if (result == 0){ + println("Бросок № $Flip: Решка. Продолжаем тренировку.") + continue + } + else if (result == 1){ + println ("Бросок № $Flip: орёл. Цель достигнута.") + break + } + } + for (turn in 5 downTo 1){ + println("До конца действия эффекта 'Сон' осталось ходов: $turn") + } + println("Покемон проснулся и готов к бою!") +} +// Программа последовательно отсчитывает от 5 до 1 и сообщает на каждом шаге, сколько ходов осталось. Когла счетчик заканчивается, +//тогда она выводит что покемон проснулся \ No newline at end of file