diff --git a/works/lab0-3/Program.cs b/works/lab0-3/Program.cs new file mode 100644 index 0000000..ba9b745 --- /dev/null +++ b/works/lab0-3/Program.cs @@ -0,0 +1,90 @@ +/* +//task 1 +string pokemon1Name = "Пикачу"; +int pokemon1Hp = 50; +int pokemon1Attack = 12; +string pokemon2Name = "Булбазавр"; +int pokemon2Hp = 55; +int pokemon2Attack = 10; +int roundNumber = 1; +Console.WriteLine("Приготовьтесь!"); +for (int i = 3; i >= roundNumber; i--) +{ + Console.WriteLine(i + "..."); + Thread.Sleep(1000); +} +Console.WriteLine("=== БОЙ НАЧИНАЕТСЯ === "); +Console.WriteLine($"{pokemon1Name} (HP: {pokemon1Hp} / Атака: {pokemon1Attack}) VS {pokemon2Name} (HP: {pokemon2Hp} / Атака: {pokemon2Attack}"); + +/* +//task 2 +int command; +bool isValid; +do +{ + Console.Write("Готовы начать бой? (1 - Да, 0 - Нет): "); + command = int.Parse(Console.ReadLine()); + isValid = (command == 1 || command == 0); + if (!isValid) + { + Console.WriteLine("Некорректная команда! Попробуйте снова."); + } + +} while (!isValid); +if (command == 0) +{ + Console.WriteLine("Вы отменили бой!"); + return; +} +Console.WriteLine("Бой начался! Удачи!"); + + +// task 3 +using System; + +class Program +{ + static void Main() + { + string pokemon1Name = "Пикачу"; + int pokemon1Hp = 50; + int pokemon1Attack = 12; + string pokemon2Name = "Булбазавр"; + int pokemon2Hp = 55; + int pokemon2Attack = 10; + int roundNumber = 1; + while (pokemon1Hp > 0 && pokemon2Hp > 0) + { + Console.WriteLine($"--- Раунд {roundNumber} ---"); + pokemon2Hp -= pokemon1Attack; + Console.WriteLine($"{pokemon1Name} наносит {pokemon1Attack} урона по {pokemon2Name}!"); + if (pokemon2Hp <= 0) + { + pokemon2Hp = 0; + Console.WriteLine($"{pokemon2Name} потерял сознание!"); + break; + } + pokemon1Hp -= pokemon2Attack; + Console.WriteLine($"{pokemon2Name} наносит {pokemon2Attack} урона по {pokemon1Name}!"); + if (pokemon1Hp <= 0) + { + pokemon1Hp = 0; + Console.WriteLine($"{pokemon1Name} потерял сознание!"); + break; // Досрочный выход из цикла + } + Console.WriteLine($"Итог раунда: {pokemon1Name} HP: {pokemon1Hp} | {pokemon2Name} HP: {pokemon2Hp}"); + roundNumber++; + } + Console.WriteLine("=== БОЙ ОКОНЧЕН ==="); + + if (pokemon1Hp > 0) + { + Console.WriteLine($"Победитель: {pokemon1Name}!"); + } + else + { + Console.WriteLine($"Победитель: {pokemon2Name}!"); + } + } +} +*/ diff --git a/works/lab0-3/Program.cs.html b/works/lab0-3/Program.cs.html deleted file mode 100644 index 9eb1041..0000000 --- a/works/lab0-3/Program.cs.html +++ /dev/null @@ -1,113 +0,0 @@ - - -Program.cs - - - - - -
- -Program.cs -
-
/* 
-//task 1 
-string pokemon1Name = "Пикачу"; 
-int pokemon1Hp = 50; 
-int  pokemon1Attack = 12; 
-string pokemon2Name = "Булбазавр"; 
-int pokemon2Hp = 55; 
-int  pokemon2Attack = 10; 
-int roundNumber = 1; 
-Console.WriteLine("Приготовьтесь!"); 
-for (int i = 3; i >= roundNumber; i--) 
-{ 
-    Console.WriteLine(i + "..."); 
-    Thread.Sleep(1000); 
-} 
-Console.WriteLine("=== БОЙ НАЧИНАЕТСЯ === "); 
-Console.WriteLine($"{pokemon1Name} (HP: {pokemon1Hp} / Атака: {pokemon1Attack}) VS {pokemon2Name} (HP: {pokemon2Hp} / Атака: {pokemon2Attack}"); 
- 
-/* 
-//task  2  
-int command; 
-bool isValid; 
-do 
-{ 
-    Console.Write("Готовы начать бой? (1 - Да, 0 - Нет): "); 
-    command = int.Parse(Console.ReadLine()); 
-    isValid = (command == 1 || command == 0); 
-    if (!isValid) 
-    { 
-        Console.WriteLine("Некорректная команда! Попробуйте снова."); 
-    } 
- 
-} while (!isValid); 
-if (command == 0) 
-{ 
-    Console.WriteLine("Вы отменили бой!"); 
-    return;  
-} 
-Console.WriteLine("Бой начался! Удачи!"); 
-*/ 
-
-// task 3 
-using System;
-
-class Program
-{
-    static void Main()
-    {
-        string pokemon1Name = "Пикачу";
-        int pokemon1Hp = 50;
-        int pokemon1Attack = 12;
-        string pokemon2Name = "Булбазавр";
-        int pokemon2Hp = 55;
-        int pokemon2Attack = 10;
-        int roundNumber = 1;
-        while (pokemon1Hp > 0 && pokemon2Hp > 0)
-        {
-            Console.WriteLine($"--- Раунд {roundNumber} ---");
-            pokemon2Hp -= pokemon1Attack;
-            Console.WriteLine($"{pokemon1Name} наносит {pokemon1Attack} урона по {pokemon2Name}!");
-            if (pokemon2Hp <= 0)
-            {
-                pokemon2Hp = 0;
-                Console.WriteLine($"{pokemon2Name} потерял сознание!");
-                break; 
-            }
-            pokemon1Hp -= pokemon2Attack;
-            Console.WriteLine($"{pokemon2Name} наносит {pokemon2Attack} урона по {pokemon1Name}!");
-            if (pokemon1Hp <= 0)
-            {
-                pokemon1Hp = 0;
-                Console.WriteLine($"{pokemon1Name} потерял сознание!");
-                break; // Досрочный выход из цикла
-            }
-            Console.WriteLine($"Итог раунда: {pokemon1Name} HP: {pokemon1Hp} | {pokemon2Name} HP: {pokemon2Hp}");
-            roundNumber++;
-        }
-        Console.WriteLine("=== БОЙ ОКОНЧЕН ===");
-        
-        if (pokemon1Hp > 0)
-        {
-            Console.WriteLine($"Победитель: {pokemon1Name}!");
-        }
-        else
-        {
-            Console.WriteLine($"Победитель: {pokemon2Name}!");
-        }
-    }
-}
-
-
-
- - \ No newline at end of file