delete fix lab03 c#
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,37 +0,0 @@
|
||||
{
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "C:\\prog-radzh\\works\\Csharp\\lab-03\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{90AD7B65-770E-4FB3-BC44-2FC8A293FDDE}|lab-03\\lab-03.csproj|c:\\prog-radzh\\works\\csharp\\lab-03\\lab-03\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{90AD7B65-770E-4FB3-BC44-2FC8A293FDDE}|lab-03\\lab-03.csproj|solutionrelative:lab-03\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
"VerticalTabListWidth": 256,
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 0,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "Program.cs",
|
||||
"DocumentMoniker": "C:\\prog-radzh\\works\\Csharp\\lab-03\\lab-03\\Program.cs",
|
||||
"RelativeDocumentMoniker": "lab-03\\Program.cs",
|
||||
"ToolTip": "C:\\prog-radzh\\works\\Csharp\\lab-03\\lab-03\\Program.cs",
|
||||
"RelativeToolTip": "lab-03\\Program.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2026-09-08T18:49:46.902Z",
|
||||
"EditorCaption": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
{
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "C:\\prog-radzh\\works\\Csharp\\lab-03\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{90AD7B65-770E-4FB3-BC44-2FC8A293FDDE}|lab-03\\lab-03.csproj|c:\\prog-radzh\\works\\csharp\\lab-03\\lab-03\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{90AD7B65-770E-4FB3-BC44-2FC8A293FDDE}|lab-03\\lab-03.csproj|solutionrelative:lab-03\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
"VerticalTabListWidth": 256,
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 0,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "Program.cs",
|
||||
"DocumentMoniker": "C:\\prog-radzh\\works\\Csharp\\lab-03\\lab-03\\Program.cs",
|
||||
"RelativeDocumentMoniker": "lab-03\\Program.cs",
|
||||
"ToolTip": "C:\\prog-radzh\\works\\Csharp\\lab-03\\lab-03\\Program.cs",
|
||||
"RelativeToolTip": "lab-03\\Program.cs",
|
||||
"ViewState": "AgIAAAAAAAAAAAAAAAAAACEAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2026-09-08T18:49:46.902Z",
|
||||
"EditorCaption": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.37614.0 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lab-03", "lab-03\lab-03.csproj", "{90AD7B65-770E-4FB3-BC44-2FC8A293FDDE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{90AD7B65-770E-4FB3-BC44-2FC8A293FDDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{90AD7B65-770E-4FB3-BC44-2FC8A293FDDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{90AD7B65-770E-4FB3-BC44-2FC8A293FDDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{90AD7B65-770E-4FB3-BC44-2FC8A293FDDE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {4E2974E8-28C9-47E5-99A5-F84249F3DF3C}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,44 +0,0 @@
|
||||
// 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
|
||||
|
||||
using System.ComponentModel.Design;
|
||||
|
||||
int choice;
|
||||
Console.Write("Готовы начать бой? (1 - Да, 0 - Нет): ");
|
||||
|
||||
do
|
||||
{
|
||||
choice = int.Parse(Console.ReadLine());
|
||||
if (choice == 1)
|
||||
{
|
||||
Console.WriteLine("Вы начали бой!");
|
||||
}
|
||||
|
||||
else if (choice == 0)
|
||||
{
|
||||
Console.WriteLine("Вы отменили бой!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Некорректная команда! Попробуйте снова.");
|
||||
}
|
||||
} while (choice != 1 && choice != 0);
|
||||
@@ -1,11 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<RootNamespace>lab_03</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,4 +0,0 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")]
|
||||
@@ -1,22 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("lab-03")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+494da37720a35a8e6f1afbe4a8830aa4493c43b7")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("lab-03")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("lab-03")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Generated by the MSBuild WriteCodeFragment class.
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
deb11dc12e69503452c0048f81f5a7a5538b6575cb69d80def424034c77d25a7
|
||||
@@ -1,18 +0,0 @@
|
||||
is_global = true
|
||||
build_property.TargetFramework = net9.0
|
||||
build_property.TargetFrameworkIdentifier = .NETCoreApp
|
||||
build_property.TargetFrameworkVersion = v9.0
|
||||
build_property.TargetPlatformMinVersion =
|
||||
build_property.UsingMicrosoftNETSdkWeb =
|
||||
build_property.ProjectTypeGuids =
|
||||
build_property.InvariantGlobalization =
|
||||
build_property.PlatformNeutralAssembly =
|
||||
build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property.EntryPointFilePath =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = lab_03
|
||||
build_property.ProjectDir = Z:\prog-radzh\works\Csharp\lab-03\lab-03\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
build_property.EffectiveAnalysisLevelStyle = 9.0
|
||||
build_property.EnableCodeStyleSeverity =
|
||||
@@ -1,8 +0,0 @@
|
||||
// <auto-generated/>
|
||||
global using System;
|
||||
global using System.Collections.Generic;
|
||||
global using System.IO;
|
||||
global using System.Linq;
|
||||
global using System.Net.Http;
|
||||
global using System.Threading;
|
||||
global using System.Threading.Tasks;
|
||||
Binary file not shown.
@@ -1,87 +0,0 @@
|
||||
{
|
||||
"format": 1,
|
||||
"restore": {
|
||||
"Z:\\prog-radzh\\works\\Csharp\\lab-03\\lab-03\\lab-03.csproj": {}
|
||||
},
|
||||
"projects": {
|
||||
"Z:\\prog-radzh\\works\\Csharp\\lab-03\\lab-03\\lab-03.csproj": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "Z:\\prog-radzh\\works\\Csharp\\lab-03\\lab-03\\lab-03.csproj",
|
||||
"projectName": "lab-03",
|
||||
"projectPath": "Z:\\prog-radzh\\works\\Csharp\\lab-03\\lab-03\\lab-03.csproj",
|
||||
"packagesPath": "C:\\Users\\228p\\.nuget\\packages\\",
|
||||
"outputPath": "Z:\\prog-radzh\\works\\Csharp\\lab-03\\lab-03\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\228p\\AppData\\Roaming\\NuGet\\NuGet.Config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net9.0"
|
||||
],
|
||||
"sources": {
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"framework": "net9.0",
|
||||
"targetAlias": "net9.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
},
|
||||
"SdkAnalysisLevel": "10.0.400"
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"framework": "net9.0",
|
||||
"targetAlias": "net9.0",
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"downloadDependencies": [
|
||||
{
|
||||
"name": "Microsoft.AspNetCore.App.Ref",
|
||||
"version": "[9.0.19, 9.0.19]"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft.NETCore.App.Host.win-x64",
|
||||
"version": "[9.0.19, 9.0.19]"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft.NETCore.App.Ref",
|
||||
"version": "[9.0.19, 9.0.19]"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft.WindowsDesktop.App.Ref",
|
||||
"version": "[9.0.19, 9.0.19]"
|
||||
}
|
||||
],
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\10.0.400/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\228p\.nuget\packages\</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">7.0.0</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\228p\.nuget\packages\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
||||
@@ -1,92 +0,0 @@
|
||||
{
|
||||
"version": 4,
|
||||
"targets": {
|
||||
"net9.0": {}
|
||||
},
|
||||
"libraries": {},
|
||||
"projectFileDependencyGroups": {
|
||||
"net9.0": []
|
||||
},
|
||||
"packageFolders": {
|
||||
"C:\\Users\\228p\\.nuget\\packages\\": {}
|
||||
},
|
||||
"project": {
|
||||
"version": "1.0.0",
|
||||
"restore": {
|
||||
"projectUniqueName": "Z:\\prog-radzh\\works\\Csharp\\lab-03\\lab-03\\lab-03.csproj",
|
||||
"projectName": "lab-03",
|
||||
"projectPath": "Z:\\prog-radzh\\works\\Csharp\\lab-03\\lab-03\\lab-03.csproj",
|
||||
"packagesPath": "C:\\Users\\228p\\.nuget\\packages\\",
|
||||
"outputPath": "Z:\\prog-radzh\\works\\Csharp\\lab-03\\lab-03\\obj\\",
|
||||
"projectStyle": "PackageReference",
|
||||
"configFilePaths": [
|
||||
"C:\\Users\\228p\\AppData\\Roaming\\NuGet\\NuGet.Config"
|
||||
],
|
||||
"originalTargetFrameworks": [
|
||||
"net9.0"
|
||||
],
|
||||
"sources": {
|
||||
"https://api.nuget.org/v3/index.json": {}
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"framework": "net9.0",
|
||||
"targetAlias": "net9.0",
|
||||
"projectReferences": {}
|
||||
}
|
||||
},
|
||||
"warningProperties": {
|
||||
"warnAsError": [
|
||||
"NU1605"
|
||||
]
|
||||
},
|
||||
"restoreAuditProperties": {
|
||||
"enableAudit": "true",
|
||||
"auditLevel": "low",
|
||||
"auditMode": "direct"
|
||||
},
|
||||
"SdkAnalysisLevel": "10.0.400"
|
||||
},
|
||||
"frameworks": {
|
||||
"net9.0": {
|
||||
"framework": "net9.0",
|
||||
"targetAlias": "net9.0",
|
||||
"imports": [
|
||||
"net461",
|
||||
"net462",
|
||||
"net47",
|
||||
"net471",
|
||||
"net472",
|
||||
"net48",
|
||||
"net481"
|
||||
],
|
||||
"assetTargetFallback": true,
|
||||
"warn": true,
|
||||
"downloadDependencies": [
|
||||
{
|
||||
"name": "Microsoft.AspNetCore.App.Ref",
|
||||
"version": "[9.0.19, 9.0.19]"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft.NETCore.App.Host.win-x64",
|
||||
"version": "[9.0.19, 9.0.19]"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft.NETCore.App.Ref",
|
||||
"version": "[9.0.19, 9.0.19]"
|
||||
},
|
||||
{
|
||||
"name": "Microsoft.WindowsDesktop.App.Ref",
|
||||
"version": "[9.0.19, 9.0.19]"
|
||||
}
|
||||
],
|
||||
"frameworkReferences": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\10.0.400/PortableRuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "AbblvEY9Z5o=",
|
||||
"success": true,
|
||||
"projectFilePath": "Z:\\prog-radzh\\works\\Csharp\\lab-03\\lab-03\\lab-03.csproj",
|
||||
"expectedPackageFiles": [
|
||||
"C:\\Users\\228p\\.nuget\\packages\\microsoft.netcore.app.ref\\9.0.19\\microsoft.netcore.app.ref.9.0.19.nupkg.sha512",
|
||||
"C:\\Users\\228p\\.nuget\\packages\\microsoft.windowsdesktop.app.ref\\9.0.19\\microsoft.windowsdesktop.app.ref.9.0.19.nupkg.sha512",
|
||||
"C:\\Users\\228p\\.nuget\\packages\\microsoft.aspnetcore.app.ref\\9.0.19\\microsoft.aspnetcore.app.ref.9.0.19.nupkg.sha512",
|
||||
"C:\\Users\\228p\\.nuget\\packages\\microsoft.netcore.app.host.win-x64\\9.0.19\\microsoft.netcore.app.host.win-x64.9.0.19.nupkg.sha512"
|
||||
],
|
||||
"logs": []
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
"restore":{"projectUniqueName":"Z:\\prog-radzh\\works\\Csharp\\lab-03\\lab-03\\lab-03.csproj","projectName":"lab-03","projectPath":"Z:\\prog-radzh\\works\\Csharp\\lab-03\\lab-03\\lab-03.csproj","packagesPath":"","outputPath":"Z:\\prog-radzh\\works\\Csharp\\lab-03\\lab-03\\obj\\","projectStyle":"PackageReference","originalTargetFrameworks":["net9.0"],"sources":{"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net9.0":{"framework":"net9.0","targetAlias":"net9.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"},"SdkAnalysisLevel":"10.0.400"}"frameworks":{"net9.0":{"framework":"net9.0","targetAlias":"net9.0","imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"downloadDependencies":[{"name":"Microsoft.AspNetCore.App.Ref","version":"[9.0.19, 9.0.19]"},{"name":"Microsoft.NETCore.App.Host.win-x64","version":"[9.0.19, 9.0.19]"},{"name":"Microsoft.NETCore.App.Ref","version":"[9.0.19, 9.0.19]"},{"name":"Microsoft.WindowsDesktop.App.Ref","version":"[9.0.19, 9.0.19]"}],"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\10.0.400/PortableRuntimeIdentifierGraph.json"}}
|
||||
@@ -1 +0,0 @@
|
||||
17889352130712831
|
||||
@@ -0,0 +1,90 @@
|
||||
fun main() {
|
||||
// ЧАСТЬ 1. Проверка условий через if-else
|
||||
println("=== ПРОВЕРКА СОСТОЯНИЯ ПОКЕМОНА ===")
|
||||
|
||||
print("Введите текущее HP: ")
|
||||
val currentHpInput = readln().toIntOrNull() ?: 0
|
||||
|
||||
print("Введите количество энергии: ")
|
||||
val energyAttachedInput = readln().toIntOrNull() ?: 0
|
||||
|
||||
println()
|
||||
|
||||
// 1.1 Классический if-else
|
||||
if (currentHpInput <= 0) {
|
||||
println("Покемон в нокауте.")
|
||||
} else {
|
||||
println("Покемон в строю и готов к бою.")
|
||||
}
|
||||
|
||||
// 1.2 if-else как выражение
|
||||
val attackStatus = if (energyAttachedInput >= 3) {
|
||||
"Доступна атака 'Giga Impact'"
|
||||
} else {
|
||||
"Недостаточно ресурсов: требуется минимум 3 карты энергии"
|
||||
}
|
||||
println("Статус атаки: $attackStatus")
|
||||
|
||||
|
||||
// ЧАСТЬ 2. Обработка типов и состояний через when
|
||||
println("\n=== РОЗЫГРЫШ КАРТЫ ТРЕНЕРА ===")
|
||||
|
||||
print("Введите название карты Тренера: ")
|
||||
val trainerCardInput = readln()
|
||||
|
||||
// 2.1 Классический when
|
||||
print("Эффект: ")
|
||||
when (trainerCardInput) {
|
||||
"Potion" -> println("Лечение +30 HP.")
|
||||
"Professor's Research" -> println("Добор 7 карт из колоды.")
|
||||
"Switch" -> println("Замена активного Покемона.")
|
||||
else -> println("Неизвестная карта Тренера.")
|
||||
}
|
||||
|
||||
|
||||
println("\n=== РАСЧЕТ СТИХИЙНОГО МНОЖИТЕЛЯ ===")
|
||||
|
||||
print("Введите стихию Покемона (Fire, Water, Grass): ")
|
||||
val elementInput = readln()
|
||||
|
||||
// 2.2 when как выражение с многострочными блоками { }
|
||||
val weaknessMultiplier: Double = when (elementInput) {
|
||||
"Water" -> {
|
||||
println("[Слабость к Электричеству]")
|
||||
2.0
|
||||
}
|
||||
"Fire" -> {
|
||||
println("[Слабость к Воде]")
|
||||
1.5
|
||||
}
|
||||
"Grass" -> {
|
||||
println("[Слабость к Огню]")
|
||||
1.2
|
||||
}
|
||||
else -> {
|
||||
println("[Базовый коэффициент]")
|
||||
1.0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
println()
|
||||
print("Введите текущий % HP (0-100): ")
|
||||
val hpPercent = readln().toIntOrNull() ?: 0
|
||||
|
||||
// 3.1 Безаргументный when
|
||||
val healthState: String = when {
|
||||
hpPercent == 0 -> "Нокаут"
|
||||
hpPercent in 1..20 -> "Критическое состояние"
|
||||
hpPercent in 21..70 -> "Поврежден"
|
||||
else -> "Отличное состояние"
|
||||
}
|
||||
|
||||
|
||||
|
||||
println("\n========================================")
|
||||
println("ИТОГОВЫЙ СТАТУС БОЯ:")
|
||||
println("Множитель урона: x$weaknessMultiplier")
|
||||
println("Категория здоровья: $healthState")
|
||||
println("========================================")
|
||||
}
|
||||
@@ -21,5 +21,6 @@
|
||||
| :-: | :--- | :-: | :-: |
|
||||
| **01** | **Тема:** Введение в язык Kotlin. Переменные, базовые типы данных и консольный ввод/вывод информации | [lab-01](./lab-01) | `Завершено` |
|
||||
| **02** | **Тема:** Приведение типов данных (casting) и математические операции в языке Kotlin | [lab-02](./lab-02) | `Завершено` |
|
||||
| **03** | **Тема:**Управляющие конструкции if-else, when | [lab-03](./lab-03) | `Завершено` |
|
||||
|
||||
---
|
||||
Reference in New Issue
Block a user