From 259a3a8d2b7a117270dbe898288649818ccfb53d Mon Sep 17 00:00:00 2001 From: polyphemus Date: Mon, 19 Oct 2026 14:19:45 +0300 Subject: [PATCH] lab-06 --- works/Algo/lab-01/lab-01.sln | 16 ++++++ works/Algo/lab-01/lab-01/Program.cs | 52 +++++++++++++++++++ works/Algo/lab-01/lab-01/lab-01.csproj | 11 ++++ works/Api/lab-02/Pokemon/Pokemon.csproj | 13 +++++ works/Api/lab-02/Pokemon/Pokemon.http | 6 +++ works/Api/lab-02/Pokemon/Program.cs | 41 +++++++++++++++ .../Pokemon/Properties/launchSettings.json | 23 ++++++++ .../Pokemon/appsettings.Development.json | 8 +++ works/Api/lab-02/Pokemon/appsettings.json | 9 ++++ .../PokemonStorage/PokemonStorage.csproj | 10 ++++ works/Api/lab-02/PokemonStorage/Program.cs | 11 ++++ .../Api/lab-02/Pokemon_0.1/Pokemon_0.1.csproj | 11 ++++ works/Api/lab-02/Pokemon_0.1/Program.cs | 7 +++ works/Api/lab-02/lab-02.sln | 18 +++++++ works/Api/lab-02/lab-02/Models/Pokemon.cs | 7 +++ works/Api/lab-02/lab-02/Program.cs | 12 +++++ .../lab-02/Properties/launchSettings.json | 23 ++++++++ .../lab-02/lab-02/Storage/PokemonStorage.cs | 33 ++++++++++++ .../lab-02/appsettings.Development.json | 8 +++ works/Api/lab-02/lab-02/appsettings.json | 9 ++++ works/Api/lab-02/lab-02/lab-02.csproj | 19 +++++++ works/Api/lab-02/lab-02/lab-02.http | 6 +++ works/Kotlin/lab-06/.gitignore | 32 ++++++++++++ works/Kotlin/lab-06/src/Main.kt | 11 ++++ 24 files changed, 396 insertions(+) create mode 100644 works/Algo/lab-01/lab-01.sln create mode 100644 works/Algo/lab-01/lab-01/Program.cs create mode 100644 works/Algo/lab-01/lab-01/lab-01.csproj create mode 100644 works/Api/lab-02/Pokemon/Pokemon.csproj create mode 100644 works/Api/lab-02/Pokemon/Pokemon.http create mode 100644 works/Api/lab-02/Pokemon/Program.cs create mode 100644 works/Api/lab-02/Pokemon/Properties/launchSettings.json create mode 100644 works/Api/lab-02/Pokemon/appsettings.Development.json create mode 100644 works/Api/lab-02/Pokemon/appsettings.json create mode 100644 works/Api/lab-02/PokemonStorage/PokemonStorage.csproj create mode 100644 works/Api/lab-02/PokemonStorage/Program.cs create mode 100644 works/Api/lab-02/Pokemon_0.1/Pokemon_0.1.csproj create mode 100644 works/Api/lab-02/Pokemon_0.1/Program.cs create mode 100644 works/Api/lab-02/lab-02.sln create mode 100644 works/Api/lab-02/lab-02/Models/Pokemon.cs create mode 100644 works/Api/lab-02/lab-02/Program.cs create mode 100644 works/Api/lab-02/lab-02/Properties/launchSettings.json create mode 100644 works/Api/lab-02/lab-02/Storage/PokemonStorage.cs create mode 100644 works/Api/lab-02/lab-02/appsettings.Development.json create mode 100644 works/Api/lab-02/lab-02/appsettings.json create mode 100644 works/Api/lab-02/lab-02/lab-02.csproj create mode 100644 works/Api/lab-02/lab-02/lab-02.http create mode 100644 works/Kotlin/lab-06/.gitignore create mode 100644 works/Kotlin/lab-06/src/Main.kt diff --git a/works/Algo/lab-01/lab-01.sln b/works/Algo/lab-01/lab-01.sln new file mode 100644 index 0000000..eb12e26 --- /dev/null +++ b/works/Algo/lab-01/lab-01.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lab-01", "lab-01\lab-01.csproj", "{BB50D7B0-E655-40BA-8766-BFEAA1A2D5DC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BB50D7B0-E655-40BA-8766-BFEAA1A2D5DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BB50D7B0-E655-40BA-8766-BFEAA1A2D5DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BB50D7B0-E655-40BA-8766-BFEAA1A2D5DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BB50D7B0-E655-40BA-8766-BFEAA1A2D5DC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/works/Algo/lab-01/lab-01/Program.cs b/works/Algo/lab-01/lab-01/Program.cs new file mode 100644 index 0000000..0488163 --- /dev/null +++ b/works/Algo/lab-01/lab-01/Program.cs @@ -0,0 +1,52 @@ +class PokemonStage +{ + public string Name { get; set; } + public string Type { get; set; } + public string RequiredLevel { get; set; } + + public PokemonStage(string name, string type, string requiredLevel) + { + Name = name; + Type = type; + RequiredLevel = requiredLevel; + } + + public void ShowInfo() + { + Console.WriteLine($"Имя: {Name}, Тип: {Type}, Уровень эвлюции: {RequiredLevel}"); + } +} + +class EvolutionNode +{ + public PokemonStage Data; + public EvolutionNode Next; + + public EvolutionNode(PokemonStage data) + { + Data = data; + Next = null; + } +} + +class EvolutionLine +{ + public EvolutionNode Head; + public EvolutionNode Tail; + public int Count; + + AddFirst(PokemonStage stage) + { + + } + + AddLast(PokemonStage stage) + { + + } + + PrintAll() + { + + } +} \ No newline at end of file diff --git a/works/Algo/lab-01/lab-01/lab-01.csproj b/works/Algo/lab-01/lab-01/lab-01.csproj new file mode 100644 index 0000000..c5a245f --- /dev/null +++ b/works/Algo/lab-01/lab-01/lab-01.csproj @@ -0,0 +1,11 @@ + + + + Exe + net10.0 + lab_01 + enable + enable + + + diff --git a/works/Api/lab-02/Pokemon/Pokemon.csproj b/works/Api/lab-02/Pokemon/Pokemon.csproj new file mode 100644 index 0000000..3939e20 --- /dev/null +++ b/works/Api/lab-02/Pokemon/Pokemon.csproj @@ -0,0 +1,13 @@ + + + + net10.0 + enable + enable + + + + + + + diff --git a/works/Api/lab-02/Pokemon/Pokemon.http b/works/Api/lab-02/Pokemon/Pokemon.http new file mode 100644 index 0000000..08c8dfe --- /dev/null +++ b/works/Api/lab-02/Pokemon/Pokemon.http @@ -0,0 +1,6 @@ +@Pokemon_HostAddress = http://localhost:5288 + +GET {{Pokemon_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/works/Api/lab-02/Pokemon/Program.cs b/works/Api/lab-02/Pokemon/Program.cs new file mode 100644 index 0000000..d5e0ef3 --- /dev/null +++ b/works/Api/lab-02/Pokemon/Program.cs @@ -0,0 +1,41 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. +// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi +builder.Services.AddOpenApi(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.MapOpenApi(); +} + +app.UseHttpsRedirection(); + +var summaries = new[] +{ + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" +}; + +app.MapGet("/weatherforecast", () => + { + var forecast = Enumerable.Range(1, 5).Select(index => + new WeatherForecast + ( + DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + Random.Shared.Next(-20, 55), + summaries[Random.Shared.Next(summaries.Length)] + )) + .ToArray(); + return forecast; + }) + .WithName("GetWeatherForecast"); + +app.Run(); + +record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary) +{ + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); +} \ No newline at end of file diff --git a/works/Api/lab-02/Pokemon/Properties/launchSettings.json b/works/Api/lab-02/Pokemon/Properties/launchSettings.json new file mode 100644 index 0000000..f912b66 --- /dev/null +++ b/works/Api/lab-02/Pokemon/Properties/launchSettings.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "http://localhost:5288", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7187;http://localhost:5288", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/works/Api/lab-02/Pokemon/appsettings.Development.json b/works/Api/lab-02/Pokemon/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/works/Api/lab-02/Pokemon/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/works/Api/lab-02/Pokemon/appsettings.json b/works/Api/lab-02/Pokemon/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/works/Api/lab-02/Pokemon/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/works/Api/lab-02/PokemonStorage/PokemonStorage.csproj b/works/Api/lab-02/PokemonStorage/PokemonStorage.csproj new file mode 100644 index 0000000..6c1dc92 --- /dev/null +++ b/works/Api/lab-02/PokemonStorage/PokemonStorage.csproj @@ -0,0 +1,10 @@ + + + + Exe + net10.0 + enable + enable + + + diff --git a/works/Api/lab-02/PokemonStorage/Program.cs b/works/Api/lab-02/PokemonStorage/Program.cs new file mode 100644 index 0000000..9db5047 --- /dev/null +++ b/works/Api/lab-02/PokemonStorage/Program.cs @@ -0,0 +1,11 @@ +using PokedexApi.Models; + +namespace PokedexApi.Storage; + +public class PokemonStorage +{ + public PokemonStorage() + { + + } +} \ No newline at end of file diff --git a/works/Api/lab-02/Pokemon_0.1/Pokemon_0.1.csproj b/works/Api/lab-02/Pokemon_0.1/Pokemon_0.1.csproj new file mode 100644 index 0000000..b72541a --- /dev/null +++ b/works/Api/lab-02/Pokemon_0.1/Pokemon_0.1.csproj @@ -0,0 +1,11 @@ + + + + Exe + net10.0 + Pokemon_0._1 + enable + enable + + + diff --git a/works/Api/lab-02/Pokemon_0.1/Program.cs b/works/Api/lab-02/Pokemon_0.1/Program.cs new file mode 100644 index 0000000..25ef3e4 --- /dev/null +++ b/works/Api/lab-02/Pokemon_0.1/Program.cs @@ -0,0 +1,7 @@ +namespace PokedexApi.Models; + +public record Pokemon(int Id, string Name, string Type, int Level); + +public record PokemonInput(string Name, string Type, int Level); + +public record LevelUpdate(int Level); diff --git a/works/Api/lab-02/lab-02.sln b/works/Api/lab-02/lab-02.sln new file mode 100644 index 0000000..1895913 --- /dev/null +++ b/works/Api/lab-02/lab-02.sln @@ -0,0 +1,18 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lab-02", "lab-02\lab-02.csproj", "{693A9649-443F-4CC8-B8BA-EB460AC8D70E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {693A9649-443F-4CC8-B8BA-EB460AC8D70E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {693A9649-443F-4CC8-B8BA-EB460AC8D70E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {693A9649-443F-4CC8-B8BA-EB460AC8D70E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {693A9649-443F-4CC8-B8BA-EB460AC8D70E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + EndGlobalSection +EndGlobal diff --git a/works/Api/lab-02/lab-02/Models/Pokemon.cs b/works/Api/lab-02/lab-02/Models/Pokemon.cs new file mode 100644 index 0000000..25ef3e4 --- /dev/null +++ b/works/Api/lab-02/lab-02/Models/Pokemon.cs @@ -0,0 +1,7 @@ +namespace PokedexApi.Models; + +public record Pokemon(int Id, string Name, string Type, int Level); + +public record PokemonInput(string Name, string Type, int Level); + +public record LevelUpdate(int Level); diff --git a/works/Api/lab-02/lab-02/Program.cs b/works/Api/lab-02/lab-02/Program.cs new file mode 100644 index 0000000..2ec7800 --- /dev/null +++ b/works/Api/lab-02/lab-02/Program.cs @@ -0,0 +1,12 @@ +var builder = WebApplication.CreateBuilder(args); + +builder.Services.AddOpenApi(); + +var app = builder.Build(); + +if (app.Environment.IsDevelopment()) +{ + app.MapOpenApi(); +} + +app.Run(); \ No newline at end of file diff --git a/works/Api/lab-02/lab-02/Properties/launchSettings.json b/works/Api/lab-02/lab-02/Properties/launchSettings.json new file mode 100644 index 0000000..abc2085 --- /dev/null +++ b/works/Api/lab-02/lab-02/Properties/launchSettings.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://json.schemastore.org/launchsettings.json", + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "http://localhost:5014", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": false, + "applicationUrl": "https://localhost:7036;http://localhost:5014", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/works/Api/lab-02/lab-02/Storage/PokemonStorage.cs b/works/Api/lab-02/lab-02/Storage/PokemonStorage.cs new file mode 100644 index 0000000..5689a8d --- /dev/null +++ b/works/Api/lab-02/lab-02/Storage/PokemonStorage.cs @@ -0,0 +1,33 @@ +using PokedexApi.Models; + +namespace PokedexApi.Storage; + +public class PokemonStorage +{ + private List _pokemons = new List + { + new Pokemon(1, "Pikachu", "Electric", 12), + new Pokemon(2, "Charmander", "Fire", 8), + new Pokemon(3, "Squirtle", "Water", 10) + }; + + public List GetAll() + { + return new List(_pokemons); + } + + public Pokemon? GetById(int id) + { + return _pokemons.FirstOrDefault(p => p.Id == id); + } + + public List Filter(string? type, int? level) + { + return _pokemons.Where(p => p.Type == type || p.Level == level).ToList(); + } + public List SearchByName(string query) + { + return _pokemons.Where(p => p.Name.Contains(query)).ToList(); + } + public Pokemon Add(PokedexInput) +} \ No newline at end of file diff --git a/works/Api/lab-02/lab-02/appsettings.Development.json b/works/Api/lab-02/lab-02/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/works/Api/lab-02/lab-02/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/works/Api/lab-02/lab-02/appsettings.json b/works/Api/lab-02/lab-02/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/works/Api/lab-02/lab-02/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/works/Api/lab-02/lab-02/lab-02.csproj b/works/Api/lab-02/lab-02/lab-02.csproj new file mode 100644 index 0000000..1de8857 --- /dev/null +++ b/works/Api/lab-02/lab-02/lab-02.csproj @@ -0,0 +1,19 @@ + + + + net10.0 + enable + enable + lab_02 + + + + + + + + + + + + diff --git a/works/Api/lab-02/lab-02/lab-02.http b/works/Api/lab-02/lab-02/lab-02.http new file mode 100644 index 0000000..36a0a4b --- /dev/null +++ b/works/Api/lab-02/lab-02/lab-02.http @@ -0,0 +1,6 @@ +@lab_02_HostAddress = http://localhost:5014 + +GET {{lab_02_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/works/Kotlin/lab-06/.gitignore b/works/Kotlin/lab-06/.gitignore new file mode 100644 index 0000000..3ddbf4c --- /dev/null +++ b/works/Kotlin/lab-06/.gitignore @@ -0,0 +1,32 @@ +### IntelliJ IDEA ### +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Kotlin ### +.kotlin + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/works/Kotlin/lab-06/src/Main.kt b/works/Kotlin/lab-06/src/Main.kt new file mode 100644 index 0000000..a57473f --- /dev/null +++ b/works/Kotlin/lab-06/src/Main.kt @@ -0,0 +1,11 @@ +fun calcDamage(power: Int, multiplier: Double = 1.0): Double = (power * multiplier).toInt().toDouble() + +fun checkStatus(hp: Int): String { + if (hp > 0) return "В строю" + else return "Нокаут" +} + +fun printBattleLog(attacker: String, defender: String, damage: Int){ + print("=== ИНИЦИАЛИЗАЦИЯ БОЯ ===\nВведите имя вашего Покемона: Pikachu\nВведите стартовое HP (по умолчанию 60): 60") +} +