generated from admin/template
Compare commits
11
Commits
a49dcc6744
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e8c9a742e | ||
|
|
c753e0b8ea | ||
|
|
dcf07ab19c | ||
|
|
6cb82939e0 | ||
|
|
cc51d41fdb | ||
|
|
8936fbdcb2 | ||
|
|
47b21a24ec | ||
|
|
2a06aa5b8c | ||
|
|
224b78ba03 | ||
|
|
26dca4f3e0 | ||
|
|
03191a8a52 |
@@ -7,6 +7,12 @@
|
|||||||
* [Лабораторная работа №2](./works/lab-02)
|
* [Лабораторная работа №2](./works/lab-02)
|
||||||
* [Лабораторная работа №3](./works/lab-03)
|
* [Лабораторная работа №3](./works/lab-03)
|
||||||
* [Лабораторная работа №4](./works/lab-04)
|
* [Лабораторная работа №4](./works/lab-04)
|
||||||
|
* [Лабораторная работа №5](./works/lab-05)
|
||||||
|
* [Лабораторная работа №6](./works/lab-06)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
* [Техническое заданеи №1](./works/stage-01)
|
* [Техническое заданеи №1](./works/stage-01)
|
||||||
* [Техническое заданеи №1](./works/stage-02)
|
* [Техническое заданеи №2](./works/stage-02)
|
||||||
|
* [Техническое заданеи №3](./works/stage-03)
|
||||||
|
* [Техническое заданеи №4](./works/stage-04)
|
||||||
|
|||||||
+23
-6
@@ -1,15 +1,32 @@
|
|||||||
# Лабораторная работа №1
|
# Лабораторная работа №1
|
||||||
|
|
||||||
* **Студент:** [ФИО]
|
* **Студент:** [Мастио Вячеслав Алексеевич]
|
||||||
* **Вариант / Карточка:** [Например: #025 Pikachu]
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Ключевой код
|
## Ключевой код
|
||||||
```csharp
|
```csharp
|
||||||
// Самая важная часть реализации (методы, структуры, логика)
|
namespace DefaultNamespace;
|
||||||
public class Card
|
|
||||||
|
public class main
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
static void Main(string[] args) {
|
||||||
public int Hp { get; set; }
|
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();
|
||||||
|
Console.WriteLine("****************************************");
|
||||||
|
Console.WriteLine("ПАСПОРТ ПОКЕМОНА");
|
||||||
|
Console.WriteLine($"Тренер: {trainerName} (Регион: {regionName})");
|
||||||
|
Console.WriteLine($"Покемон: {pokemonName} [Стихия: {elementType}]");
|
||||||
|
Console.WriteLine("****************************************");
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
```
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
namespace DefaultNamespace;
|
||||||
|
|
||||||
|
public class main
|
||||||
|
{
|
||||||
|
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();
|
||||||
|
Console.WriteLine("****************************************");
|
||||||
|
Console.WriteLine("ПАСПОРТ ПОКЕМОНА");
|
||||||
|
Console.WriteLine($"Тренер: {trainerName} (Регион: {regionName})");
|
||||||
|
Console.WriteLine($"Покемон: {pokemonName} [Стихия: {elementType}]");
|
||||||
|
Console.WriteLine("****************************************");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
# Техническое задание №1
|
||||||
|
|
||||||
|
* **Студент:** [Мастио Вячеслав Алексеевич]
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Ключевой код
|
||||||
|
```csharp
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Console.Write("Введите, пожалуйста, стадию карточки: ");
|
||||||
|
string stage = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("Введите, пожалуйста, имя покемона: ");
|
||||||
|
string name = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("Введите, пожалуйста, вид покемона: ");
|
||||||
|
string category = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("Введите, пожалуйста, название первой атаки: ");
|
||||||
|
string attack1Name = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("Введите, пожалуйста, описание первой атаки: ");
|
||||||
|
string attack1Desc = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("Введите, пожалуйста, название второй атаки: ");
|
||||||
|
string attacck2Name = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("Введите, пожалуйста, описание второй атаки: ");
|
||||||
|
string attacck2Desc = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("Введите, пожалуйста, слабость покемона: ");
|
||||||
|
string weakness = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.Write("Введите, пожалуйста, сопротивление покемона: ");
|
||||||
|
string resistance = Console.ReadLine();
|
||||||
|
|
||||||
|
|
||||||
|
int hp = 60;
|
||||||
|
int number = 25;
|
||||||
|
double height = 0.4;
|
||||||
|
double weight = 1.0;
|
||||||
|
int attack2Damage = 20;
|
||||||
|
int retreatCost = 1;
|
||||||
|
Console.Clear();
|
||||||
|
|
||||||
|
Console.WriteLine("======================================================================");
|
||||||
|
Console.WriteLine($"[{stage}]{name} ОЖ: {hp}[⚡]" );
|
||||||
|
Console.WriteLine("----------------------------------------------------------------------");
|
||||||
|
Console.WriteLine($"№ {number} | Вид: {category} | Рост: {height} | Вес: {weight}");
|
||||||
|
Console.WriteLine("----------------------------------------------------------------------");
|
||||||
|
Console.WriteLine($"[Атака 1]{attack1Name}");
|
||||||
|
Console.WriteLine($"Эффект: {attack1Desc}");
|
||||||
|
Console.WriteLine();
|
||||||
|
Console.WriteLine($"[Атака] {attacck2Name} Урон: {attack2Damage}+");
|
||||||
|
Console.WriteLine($"Эффект: {attacck2Desc}");
|
||||||
|
Console.WriteLine("----------------------------------------------------------------------");
|
||||||
|
Console.WriteLine($"Слабость: {weakness}");
|
||||||
|
Console.WriteLine($"Устойчиов: {resistance}");
|
||||||
|
Console.WriteLine($"Отступление: {retreatCost} энергия");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
namespace DefaultNamespace;
|
||||||
|
|
||||||
|
public class ex1
|
||||||
|
{
|
||||||
|
static void HealPokemon(ref int pokemonHP)
|
||||||
|
{
|
||||||
|
pokemonHP += 80;
|
||||||
|
Console.WriteLine("[Покецентр] Покемон полностью здоров! Восстановлено 80 HP.");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Console.WriteLine("=== ПОКЕЦЕНТР: ЛЕЧЕНИЕ ===");
|
||||||
|
int pokemonHP = 20;
|
||||||
|
Console.WriteLine($"Здоровье до лечения: {pokemonHP} HP.");
|
||||||
|
|
||||||
|
HealPokemon(ref pokemonHP);
|
||||||
|
|
||||||
|
Console.WriteLine($"Здоровье после лечения: {pokemonHP} HP.");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
namespace DefaultNamespace;
|
||||||
|
|
||||||
|
public class ex2
|
||||||
|
{
|
||||||
|
static void SearchBushes(out string foundPokemon, out int pokemonLevel)
|
||||||
|
{
|
||||||
|
foundPokemon = "Пикачу";
|
||||||
|
|
||||||
|
Random random = new Random();
|
||||||
|
pokemonLevel = random.Next(1, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Console.WriteLine("=== ИССЛЕДОВАНИЕ ЛОКАЦИИ ===");
|
||||||
|
Console.WriteLine("Вы зашли в высокую траву...");
|
||||||
|
|
||||||
|
SearchBushes(out string foundPokemon, out int pokemonLevel);
|
||||||
|
|
||||||
|
Console.WriteLine($"Шорох! Из кустов появляеться дикикй {foundPokemon} (Уровень: {pokemonLevel})");
|
||||||
|
Console.WriteLine();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
namespace DefaultNamespace;
|
||||||
|
|
||||||
|
public class ex3
|
||||||
|
{
|
||||||
|
static void RegisterTourment(in double x, in double difficulty, params string[] participants)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Коэффициент стадиона: {difficulty}");
|
||||||
|
Console.WriteLine("Список участников:");
|
||||||
|
|
||||||
|
foreach (string pokemon in participants)
|
||||||
|
{
|
||||||
|
Console.WriteLine($" * {pokemon}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Console.WriteLine("=== РЕГИСТРАЦИЯ НА ТУРНИР ===");
|
||||||
|
double stadiumDifficulty = 1.5;
|
||||||
|
|
||||||
|
// Первый вызов: 2 покемона через params
|
||||||
|
RegisterTournament(in stadiumDifficulty, "Булбазавр", "Чармандер");
|
||||||
|
Console.WriteLine("-----------------------------");
|
||||||
|
|
||||||
|
// Второй вызов: 4 покемона через params
|
||||||
|
RegisterTournament(in stadiumDifficulty, "Сквиртл", "Пикачу", "Псайдак", "Мяут");
|
||||||
|
Console.WriteLine("=============================");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
namespace DefaultNamespace;
|
||||||
|
|
||||||
|
public class ex1
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Pokemon pikachu = new Pokemon("Пикачу", 5, 100);
|
||||||
|
Pokemon sqr = new Pokemon("Сквиртл", 7, 90);
|
||||||
|
|
||||||
|
pikachu.ShowInfo();
|
||||||
|
sqr.ShowInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Pokemon
|
||||||
|
{
|
||||||
|
private string name;
|
||||||
|
private int level;
|
||||||
|
private int hp;
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return name; }
|
||||||
|
set { name = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Level
|
||||||
|
{
|
||||||
|
get { return level; }
|
||||||
|
set { level = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Hp
|
||||||
|
{
|
||||||
|
get { return hp; }
|
||||||
|
set { hp = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pokemon(string name, int level, int hp)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.level = level;
|
||||||
|
this.hp = hp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowInfo()
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Имя: {this.Name}, Уровень: {this.Level}, HP: {this.Hp}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
namespace DefaultNamespace;
|
||||||
|
|
||||||
|
public class ex2
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Pokemon pika = new Pokemon("Пикачу", 1, 1);
|
||||||
|
|
||||||
|
pika.Hp = -50;
|
||||||
|
Console.WriteLine($"Текущее HP: {pika.Hp} (защита сработала)");
|
||||||
|
|
||||||
|
pika.TakeDamage(30);
|
||||||
|
Console.WriteLine($"Покемон получил 30 урона. HP: {pika.Hp}");
|
||||||
|
|
||||||
|
pika.Heal();
|
||||||
|
Console.WriteLine($"Покемон вылечился. HP: {pika.Hp}");
|
||||||
|
|
||||||
|
|
||||||
|
Pokemon egg = new Pokemon();
|
||||||
|
Console.WriteLine($"Создан покемон из яйца: Имя: {egg.Name}, Уровень: {egg.Level}, HP: {egg.Hp}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Pokemon
|
||||||
|
{
|
||||||
|
private string name;
|
||||||
|
private int level;
|
||||||
|
private int hp;
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return name; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (name == "") name = "Безымянный";
|
||||||
|
else name = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Level
|
||||||
|
{
|
||||||
|
get { return level; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value < 1) level = 1;
|
||||||
|
else if (value > 100) level = 100;
|
||||||
|
else level = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Hp
|
||||||
|
{
|
||||||
|
get { return hp; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (hp < 0) hp = 0;
|
||||||
|
else if (hp > 100) hp = 100;
|
||||||
|
else hp = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pokemon()
|
||||||
|
{
|
||||||
|
Name = "Яйцо";
|
||||||
|
Level = 1;
|
||||||
|
Hp = 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pokemon(string nmme, int level, int hp)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Level = level;
|
||||||
|
Hp = hp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int TakeDamage(int damage)
|
||||||
|
{
|
||||||
|
hp -= damage;
|
||||||
|
if (hp <= 0) return 0;
|
||||||
|
return hp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Heal()
|
||||||
|
{
|
||||||
|
hp = 100;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
namespace DefaultNamespace;
|
||||||
|
|
||||||
|
public class ex3
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Pokemon pika = new Pokemon("Пикачу", 5, 100);
|
||||||
|
Pokemon squirtle = new Pokemon("Сквиртл", 7, 90);
|
||||||
|
Pokemon bulba = new Pokemon("Бульбазавр", 6, 95);
|
||||||
|
|
||||||
|
Console.WriteLine("=== ПОКЕДЕКС: СТАТИСТИКА ===");
|
||||||
|
Console.WriteLine($"Создано покемонов: {Pokemon.Count}\n");
|
||||||
|
|
||||||
|
pika.Battle(squirtle);
|
||||||
|
|
||||||
|
Console.WriteLine("=== СОСТОЯНИЕ ПОСЛЕ БОЯ ===");
|
||||||
|
Console.WriteLine($"{pika.Name} — HP: {pika.Hp}");
|
||||||
|
Console.WriteLine($"{squirtle.Name} — HP: {squirtle.Hp}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Pokemon
|
||||||
|
{
|
||||||
|
public static int Count { get; private set; } = 0;
|
||||||
|
private string name;
|
||||||
|
private int level;
|
||||||
|
private int hp;
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return name; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (name == "") name = "Безымянный";
|
||||||
|
else name = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Level
|
||||||
|
{
|
||||||
|
get { return level; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value < 1) level = 1;
|
||||||
|
else if (value > 100) level = 100;
|
||||||
|
else level = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Hp
|
||||||
|
{
|
||||||
|
get { return hp; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (hp < 0) hp = 0;
|
||||||
|
else if (hp > 100) hp = 100;
|
||||||
|
else hp = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Pokemon(string nmme, int level, int hp)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Level = level;
|
||||||
|
Hp = hp;
|
||||||
|
Count++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pokemon()
|
||||||
|
{
|
||||||
|
Name = "Безымянный";
|
||||||
|
Level = 1;
|
||||||
|
Hp = 100;
|
||||||
|
Count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void Battle(Pokemon enemy)
|
||||||
|
{
|
||||||
|
Console.WriteLine("=== БИТВА ===");
|
||||||
|
Console.WriteLine($"{Name} (Ур. {Level}, HP {Hp}) против {enemy.Name} (Ур. {enemy.Level}, HP {enemy.Hp})");
|
||||||
|
|
||||||
|
if (Level >= enemy.Level)
|
||||||
|
{
|
||||||
|
int damage = Level;
|
||||||
|
enemy.Hp -= damage;
|
||||||
|
|
||||||
|
Console.WriteLine($"{Name} побеждает! {enemy.Name} теряет {damage} HP.");
|
||||||
|
Console.WriteLine($"Победитель: {Name}. Осталось HP: {this.Hp}");
|
||||||
|
Console.WriteLine($"Побеждённый: {enemy.Name}. Осталось HP: {enemy.Hp}\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int damage = enemy.Level;
|
||||||
|
Hp -= damage;
|
||||||
|
|
||||||
|
Console.WriteLine($"{enemy.Name} побеждает! {Name} теряет {damage} HP.");
|
||||||
|
Console.WriteLine($"Победитель: {enemy.Name}. Осталось HP: {enemy.Hp}");
|
||||||
|
Console.WriteLine($"Побеждённый: {Name}. Осталось HP: {this.Hp}\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Binary file not shown.
Reference in New Issue
Block a user