generated from admin/template
new
This commit is contained in:
@@ -119,31 +119,51 @@ namespace task
|
||||
pokedex["Bulbasaur"] = 1;
|
||||
pokedex["Charmander"] = 2;
|
||||
pokedex["Zubat"] = 3;
|
||||
|
||||
// // Проверка наличия
|
||||
// if (pokedex.ContainsKey("Pikachu"))
|
||||
// {
|
||||
// Console.WriteLine(pokedex["Pikachu"]); // 25
|
||||
// }
|
||||
//
|
||||
// // Безопасное получение
|
||||
// if (pokedex.TryGetValue("Missingno", out int num))
|
||||
// {
|
||||
// Console.WriteLine(num);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Console.WriteLine("Нет в покедексе");
|
||||
// }
|
||||
//
|
||||
// // Перебор
|
||||
// foreach (var pair in pokedex)
|
||||
// {
|
||||
// Console.WriteLine($"{pair.Key} -> {pair.Value}");
|
||||
// }
|
||||
//
|
||||
//
|
||||
|
||||
// Безопасное получение
|
||||
if (pokedex.TryGetValue("Pikachu", out int num))
|
||||
{
|
||||
Console.WriteLine(num);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Нет в покедексе");
|
||||
}
|
||||
|
||||
// Перебор
|
||||
foreach (var pair in pokedex)
|
||||
{
|
||||
Console.WriteLine($"{pair.Key} -> {pair.Value}");
|
||||
}
|
||||
|
||||
Console.WriteLine("задача 7");
|
||||
|
||||
var attack1 = new Dictionary<string, int>();
|
||||
attack1["tackle"] = 20;
|
||||
attack1["thunder"] = 40;
|
||||
attack1["quick"] = 10;
|
||||
int enemyHp = 75;
|
||||
int turn = 0;
|
||||
while (enemyHp > 0)
|
||||
{
|
||||
turn++;
|
||||
switch (turn % 3)
|
||||
{
|
||||
case 0:
|
||||
Console.WriteLine("tackle");
|
||||
break;
|
||||
case 1:
|
||||
Console.WriteLine("thunder");
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine("quick");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user