Добавлены весь файлы и папки

This commit is contained in:
=
2026-10-02 02:11:08 +03:00
parent 9c1453eda6
commit ee942fe4ae
31 changed files with 231 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

+60
View File
@@ -0,0 +1,60 @@
# ЛАБОРАТОРНАЯ РАБОТА №1
## Задание №1
```
static void Main(string[] args)
{
string pokemonName = "Чармандер"; //имя покемона
string elemeniType = "Огонь"; //тип элементы
int level = 1; //уровень
int hp = 95; //здоровье
Console.WriteLine($@"=== БАЗА ДАННЫХ ПОКЕМОНОВ ===
Покемон: {pokemonName}
Стихия: {elemeniType}
Уровень: {level} | HP: {hp}"); //вывод
}
```
###### Вывод:
=== БАЗА ДАННЫХ ПОКЕМОНОВ ===
Покемон: Чармандер
Стихия: Огонь
Уровень: 1 | HP: 95
![alt text](image-1.png)
## Задание №2
```
static void Main(string[] args)
{
Console.Write("Введите имя тренера: "); //вывод
string trainerName = Console.ReadLine(); //ввод из консоля
Console.Write("Введите имя покемона: ");
string pokemonName = Console.ReadLine();
Console.Write("Введите стихию: ");
string elementType = Console.ReadLine();
Console.Write("Введите регион: ");
string regionName = Console.ReadLine();
Console.WriteLine($@"****************************************
ПААСПОРТ ПОКЕМОНА
Тренер: {trainerName} (Регион: {regionName})
Покемон: {pokemonName} [Стихия: {elementType}]
****************************************"); //вывод
}
```
###### Вывод:
Введите имя тренера: Эш
Введите имя покемона: Булбазавр
Введите стихию: Трава
Введите регион: Канто
****************************************.
ПААСПОРТ ПОКЕМОНА
Тренер: Эш (Регион: Канто)
Покемон: Булбазавр [Стихия: Трава]
****************************************.
![alt text](image.png)
Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

+152
View File
@@ -0,0 +1,152 @@
# ЛАБОРАТОРНАЯ РАБОТА №2
## БЛОК 1
### Задание №1
```
static void Main(string[] args)
{
Console.WriteLine("=== ПРОКАЧКА ПОКЕМОНА ==="); //вывод
Console.Write("Введите базовое значение атаки покемона: "); //вывод, но запрашвает у пользователя
int baseAttack = Convert.ToInt32(Console.ReadLine()); //можно и так Convert - аналог Parse //вывод
Console.Write("Введите кол-во уровней: ");
int level = Convert.ToInt32(Console.ReadLine());
int finalAttack = baseAttack + (level * 5); //формула итоговой атаки = базовая_атака + (уровень * 5)
Console.Clear(); //Очистка консоля, сначало запрашивает у пользователя, потом очищает консоль и выводит следующий итог
Console.WriteLine($@"=== ПРОКАЧКА ПОКЕМОНА ===
Базовое значение атаки покемона: {baseAttack}
Кол-во полученных уровней: {level}"); //вывод
Thread.Sleep(1000); //таймер 1 сек
Console.WriteLine("\nФормула итоговой атаки = базовая атака + (уровень * 5)");
Console.WriteLine($"Итоговая атака равна {finalAttack}"); //вывод итоговой атаки
}
```
###### ВЫВОД:
![alt text](image.png)
### Задане №2
```
static void Main(string[] args)
{
int balance = 1500; //всего на балансе
int potion = 200; //1 зелье стоит 200 монеты
Console.WriteLine("=== ПРОФИЛЬ ===");
Console.WriteLine($@"Начальный баланс тренера: {balance}
Стоимость одного Зелья Лечения(Potion): {potion}");
Console.Write("Сколько понадобится зелье, чтобы купить: "); //вывод
int buy = Convert.ToInt32(Console.ReadLine()); //запрашивает кол-во у пользователя
int total = buy * potion; //всего итоговая оплата зелья
if (balance >= total) //проверка условие
{
balance -= total; //баланс снимает итоговой оплаты зелья
Console.WriteLine($"Стоимость {buy} зелье за {total}");
Console.WriteLine("Успешная оплата!");
Console.WriteLine($"Остаток на балансе: {balance}");
}
else
{
Console.WriteLine("Недостаточно средств!"); //не хватает монеты, если покупают больше 8 зелье
}
}
```
###### ВЫВОД:
Если хватает, то:
![alt text](image-1.png)
Если не хватает, то:
![alt text](image-2.png)
## БЛОК 2
### Задание № 2.1
```
```
###### ВЫВОД:
при hp >= 50
![alt text](image-3.png)
при hp <= 49 & hp >= 21
![alt text](image-4.png)
при hp <= 20 & hp >= 1
![alt text](image-5.png)
при hp <= 0
![alt text](image-6.png)
### Задание № 2.2
```
static void Main(string[] args)
{
Console.WriteLine("Меню: 1 - Атака, 2 - Инвентарь, 3 - Сменить покемона, 4 - Побег"); //вывод
Console.Write("Выберите меню: ");
int menu = Convert.ToInt32(Console.ReadLine()); //запрашивает у пользователя
switch (menu)
{
case 1:
Console.WriteLine("Покемон наносит быстрый удар!"); //1 клавиша
break; //конец и возвращает значение
case 2:
Console.WriteLine("Вы открыли сумку и применили Зелье Лечения."); //2 клавиша
break;
case 3:
Console.WriteLine("Вы отозвали покемона и выпустили нового!"); //3 клавиша
break;
case 4:
Console.WriteLine("Вы успешно сбежали из боя!"); //4 клавиша
break;
default:
Console.WriteLine("Неизвестная команда! Вы пропустили ход."); // неизвестная команда, если нажать любая клавиша кроме 1,2,3 и 4
break;
}
}
```
###### ВЫВОД:
Атака (при нажатии 1)
![alt text](image-7.png)
Инвентарь (при нажатии 2)
![alt text](image-8.png)
Сменить покемона (при нажатии 3)
![alt text](image-9.png)
Побег (при нажатии 4)
![alt text](image-10.png)
При нажатии любой клавиши, кроме 1-4, тогда появится неизвестная команда
![alt text](image-11.png)
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

+137
View File
@@ -0,0 +1,137 @@
# ЛАБОРАТОРНАЯ РАБОТА №3
## Задание 1
```
static void Main(string[] args)
{
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}..."); //будет циклировать пока досчитается от 3 до 1, после чего завершается цикл
Thread.Sleep(1000); //таймер 1 сек
}
Console.WriteLine("\n=== БОЙ НАЧИНАЕТСЯ ===\n");
Thread.Sleep(1000);
Console.WriteLine($"{pokemon1Name} (HP: {pokemon1Hp} | Атака: {pokemon1Attack}) VS {pokemon2Name} (HP: {pokemon2Hp} | Атака: {pokemon2Attack})");
}
```
###### ВЫВОД:
![alt text](image.png)
## Задание 2
```
static void Main(string[] args)
{
int choice;
do
{
Console.WriteLine("Готовы начать бой? (1 - Да, 2- Нет): ");
choice = Convert.ToInt32(Console.ReadLine()); //аналог Parse
if(choice != 0 && choice != 1)
{
Console.WriteLine("Некорректная команда! Попробуйте снова.");
}
} while (choice != 0 && choice != 1);
if(choice == 0)
{
Console.WriteLine("Вы начали бой!");
}
else if(choice == 1)
{
Console.WriteLine("Вы отменили бой!");
}
}
```
###### ВЫВОД:
При нажатии на клавишу 1
![alt text](image-1.png)
При нажатии на клавишу 0
![alt text](image-2.png)
При нажатии на любые клавиши
![alt text](image-3.png)
## Задание 3
```
static void Main(string[] args)
{
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} ---");
Console.WriteLine($"{pokemon1Name} наносит {pokemon1Attack} урона по {pokemon2Name}!");
pokemon2Hp -= pokemon1Attack; //Булбазавр отнимает здоровье из-за урона Пикачу
if (pokemon2Hp < 0)
{
pokemon2Hp = 0;
Console.WriteLine($"{pokemon2Name} потерял сознание");
break; //если Булзабавр потерял, цикл завершается, и бой заканчивается
}
Console.WriteLine($"{pokemon2Name} наносит {pokemon2Attack} урона по {pokemon1Name}");
pokemon1Hp -= pokemon2Attack; //Пикачу отнимает здоровье из-за удара Булбазавра
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 if ( pokemon2Hp > 0)
{
Console.WriteLine($"Победитель: {pokemon2Name}");
}
else
{
Console.WriteLine("Оба ничья!");
}
}
```
###### ВЫВОД:
![alt text](image-4.png)
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

+82
View File
@@ -0,0 +1,82 @@
# ЛАБОРАТОРНАЯ РАБОТА №5
## Задание №1
```
static void Main(string[] args)
{
int pokemonHp = 20;
Console.WriteLine($@"=== ПОКЕЦЕНТР ЛЕЧЕНИЕ ===
Здоровье до лечения: {pokemonHp} HP.");
HealPokemon(ref pokemonHp);
Console.WriteLine($"Здоровье после лечения: {pokemonHp} HP.");
}
static void HealPokemon (ref int hp)
{
int restored = 100 - hp;
hp = 100;
Console.WriteLine($"[Покецентр] Покемон полностью здоров! Восстановлено {restored} HP;");
}
```
###### ВЫВОД:
![alt text](image.png)
## Задание №2
```
static void Main(string[] args)
{
Console.WriteLine($@"=== ИССЛЕДОВАНИЕ ЛОКАЦИИ ===
Вы зашли в высокую траву...");
string pokemonname;
int level;
SearchBushes(out pokemonname, out level);
Console.WriteLine($"Шорох! Их кустов появляется дикий {pokemonname} (Уровень: {level})!");
}
static void SearchBushes(out string foundPokemon, out int pokemonLevel)
{
Random random = new Random();
pokemonLevel = random.Next(1, 16); //рандом от 1 до 15
foundPokemon = "Пикачу";
}
```
###### ВЫВОД:
![alt text](image-1.png)
## Задание №3
```
static void Main(string[] args)
{
Console.WriteLine("=== РЕГИСТРАЦИЯ НА ТУРНИР ===");
RegisterTournament(1.5, "Булбазавр", "Чармандер"); //вызываем метод, далее нужно заполнить ячейки
Console.WriteLine("-----------------------------");
RegisterTournament(1.5, "Сквиртл", "Пикачу", "Псайдак", "Мяут");
Console.WriteLine("=============================");
}
static void RegisterTournament(in double difficulty, params string[] participants)
{
Console.WriteLine($"Кэф стадиона: {difficulty}");
Console.WriteLine("Список участников: ");
foreach (string pokemon in participants) //Цикл не завершится, пока пользователь введет определенные ячейки
{
Console.WriteLine($" * {pokemon}");
}
}
```
###### ВЫВОД:
![alt text](image-2.png)