From d73ad4c04ab013f63719ebbeea018e12ebd072c9 Mon Sep 17 00:00:00 2001 From: Beth Date: Mon, 21 Sep 2026 08:55:20 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20works/lab-01/Readme.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- works/lab-01/Readme.md | 114 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 107 insertions(+), 7 deletions(-) diff --git a/works/lab-01/Readme.md b/works/lab-01/Readme.md index 388f028..5e5ddf7 100644 --- a/works/lab-01/Readme.md +++ b/works/lab-01/Readme.md @@ -1,15 +1,115 @@ # Лабораторная работа №1 -* **Студент:** [ФИО] +* **Студент:** Жукаускайте Елизавета * **Вариант / Карточка:** [Например: #025 Pikachu] --- ## Ключевой код -```csharp -// Самая важная часть реализации (методы, структуры, логика) -public class Card -{ - public string Name { get; set; } - public int Hp { get; set; } + +fun main() { + var deckSize = 60 + var cardsInHand = 0 + print("How much cards to draw?") + val targetDrawInput = readln().toIntOrNull() ?: 0 + var currentDraw = 0 + while (currentDraw < targetDrawInput && deckSize > 0) { + currentDraw++ + cardsInHand++ + deckSize-- + println("Took the cards № $currentDraw IN hand: $cardsInHand, in deck: $deckSize") + + } + println("Your HP is?") + val currentHpInput = readln().toInt() + if (currentHpInput <= 0) { + println("K.O!") + } else { + println("Pokemon ready!") + } + print("Your energy is?") + val energyAttachedInput = readln().toInt() + do { + print("How much energy the attack costs?? ") + val energyCost = readln().toIntOrNull() ?: 0 + + if (energyCost < 0) { + println("[ERROR] Attack cost can't be negative!") + } + } while (energyCost < 0) + println("Determine attack cost") + val energyCost = readln().toIntOrNull() ?: 0 + println("[Success!] Attack cost is $energyCost") + + val attackStatus = if (energyAttachedInput >= 3) { + "Ready to attack!!" + } else { + "Not enough to attack!" + } + println("Your trainer cards is?") + val trainerCardInput = readln() + when (trainerCardInput) { + "Potion" -> println("Healing +30 HP") + "Professor's Research" -> println("Take 7 cards!") + "Switch" -> println("Switch active Pokemon") + else -> println("Invalid Trainer") + } + println("What is your element?") + val elementInput = readln() + val weaknessMultiplier = when (elementInput) { + "Water" -> { + println("Electric weakness") + 2.0 + } + + "Fire" -> { + println("Water weakness") + 1.5 + } + + "Grass" -> { + println("Fire weakness") + 1.2 + } + + else -> { + println("Basic multiplier") + 1.0 + } + } + println("What is your HP percent?") + val hpPercent = readln().toInt() + val healthState = when (hpPercent) { + 0 -> "K.O" + in 1..20 -> "Critical Health" + in 21..70 -> "Good condition" + else -> "Perfect!" + } + println("Attack availability: $attackStatus") + println("Weakness multiplies: $weaknessMultiplier") + println("Current condition $healthState") + + print("Enemy HP: ") + var enemyHp =readln().toInt() + var round = 1 + while (true) { + if (round % 2 != 0) { + enemyHp -= 25 + println("Dealt 25 dmg.") + + if (enemyHp <= 0) { + println("Enemy Pokemon fell. Battle terminated.") + break + } + } else { + println("Round $round: [Defense] Round skipped.") + } + round++ + } + var damageCounters = 0 + val maxCounters = 5 + while (damageCounters < maxCounters) { + damageCounters++ + println("Damage counter accepted #$damageCounters.") + } }