From 118b3954aa532e026e63bdc5c9379b5d3a0e5ec4 Mon Sep 17 00:00:00 2001 From: Moskalm25 Date: Wed, 10 Sep 2025 08:55:02 +0200 Subject: [PATCH 01/16] zmena vypisovania v konzole --- src/AppsLab-002-ConsoleWriteLine/Program.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/AppsLab-002-ConsoleWriteLine/Program.cs b/src/AppsLab-002-ConsoleWriteLine/Program.cs index 837131c2..4e337795 100644 --- a/src/AppsLab-002-ConsoleWriteLine/Program.cs +++ b/src/AppsLab-002-ConsoleWriteLine/Program.cs @@ -1 +1,4 @@ -Console.WriteLine("Hello, World!"); \ No newline at end of file + + +//vypise do konzoli text +Console.WriteLine("Hello, Matus!"); \ No newline at end of file From 39bd4d9fd6897ab147f5f2bc7d7e441e1a5cc18a Mon Sep 17 00:00:00 2001 From: Moskalm25 Date: Wed, 10 Sep 2025 10:09:03 +0200 Subject: [PATCH 02/16] Uloha005= programovanie do konzole (poremnne) --- src/AppsLab-005-DataTypes/Program.cs | 32 ++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/AppsLab-005-DataTypes/Program.cs b/src/AppsLab-005-DataTypes/Program.cs index 3751555c..1b66b0d3 100644 --- a/src/AppsLab-005-DataTypes/Program.cs +++ b/src/AppsLab-005-DataTypes/Program.cs @@ -1,2 +1,30 @@ -// See https://aka.ms/new-console-template for more information -Console.WriteLine("Hello, World!"); + +using System; + +namespace MyApp +{ + internal class Program + { + static void Main(string[] args) + { + bool isChild = true; + Console.WriteLine(isChild); + + int myage = 6; + Console.WriteLine(myage); + + float pi = 3.14f; + Console.WriteLine(pi); + + string name = "matus"; + Console.WriteLine(name); + + char gender = 'm'; + Console.WriteLine(gender); + + + + + } + } +} \ No newline at end of file From 9d51043c06e172626574fc1a38ba746a29d00e3e Mon Sep 17 00:00:00 2001 From: Moskalm25 Date: Wed, 10 Sep 2025 13:10:04 +0200 Subject: [PATCH 03/16] =?UTF-8?q?vlastne=20nie=C4=8Do=20=C4=8Do=20chapem?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/AppsLab-005-DataTypes/Program.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/AppsLab-005-DataTypes/Program.cs b/src/AppsLab-005-DataTypes/Program.cs index 1b66b0d3..e734c745 100644 --- a/src/AppsLab-005-DataTypes/Program.cs +++ b/src/AppsLab-005-DataTypes/Program.cs @@ -7,6 +7,7 @@ internal class Program { static void Main(string[] args) { + bool isChild = true; Console.WriteLine(isChild); @@ -23,8 +24,31 @@ static void Main(string[] args) Console.WriteLine(gender); + /* int a = 10; + int b = 5; + int sum = a / b; + Console.WriteLine(sum);*/ + + int birthday = 28; + int birthmonth = 3; + int birthyeart = 2010; + + + int birthsum = birthday + birthmonth + birthyeart; + Console.WriteLine(birthsum); + + Console.WriteLine(birthsum * 10); + + Console.WriteLine(birthyeart * birthmonth + birthday); + + /* Console.WriteLine(5f/3f); + */ + + + + Console.WriteLine(name + (birthday + birthmonth)); } } } \ No newline at end of file From 0d853c788329bf43ce92c5719011bc98dff5d850 Mon Sep 17 00:00:00 2001 From: Moskalm25 Date: Wed, 1 Oct 2025 13:08:27 +0200 Subject: [PATCH 04/16] best --- AppsLab.CSharp.Exercises.sln | 48 +++++++--- Cvicenie_cykly/Cvicenie_cykly.csproj | 10 ++ Cvicenie_cykly/Program.cs | 131 ++++++++++++++++++++++++++ cvicenia_poli/Program.cs | 56 +++++++++++ cvicenia_poli/cvicenia_poli.csproj | 10 ++ src/AppsLab-005-DataTypes/Program.cs | 135 +++++++++++++++++++++++---- 6 files changed, 359 insertions(+), 31 deletions(-) create mode 100644 Cvicenie_cykly/Cvicenie_cykly.csproj create mode 100644 Cvicenie_cykly/Program.cs create mode 100644 cvicenia_poli/Program.cs create mode 100644 cvicenia_poli/cvicenia_poli.csproj diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 58bbf6b5..dfb755ed 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -93,10 +93,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-033-NuGet", "src\Ap EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-034-Debug", "src\AppsLab-034-Debug\AppsLab-034-Debug.csproj", "{83C963FD-DC23-46E8-9545-F56197164810}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cvicenie_cykly", "Cvicenie_cykly\Cvicenie_cykly.csproj", "{C852237E-6FE2-4507-953F-77FD72962445}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cvicenia_poli", "cvicenia_poli\cvicenia_poli.csproj", "{D89F9F5D-C56A-4412-AEC1-9AD018322387}" +EndProject Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 @@ -226,18 +227,6 @@ Global {A6659FD2-5F11-432B-91B7-C64EAEAF669C}.Release|x64.Build.0 = Release|Any CPU {A6659FD2-5F11-432B-91B7-C64EAEAF669C}.Release|x86.ActiveCfg = Release|Any CPU {A6659FD2-5F11-432B-91B7-C64EAEAF669C}.Release|x86.Build.0 = Release|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|x64.ActiveCfg = Debug|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|x64.Build.0 = Debug|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|x86.ActiveCfg = Debug|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|x86.Build.0 = Debug|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|Any CPU.Build.0 = Release|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|x64.ActiveCfg = Release|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|x64.Build.0 = Release|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|x86.ActiveCfg = Release|Any CPU - {B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|x86.Build.0 = Release|Any CPU {FD645D4C-9DC8-4603-A77B-8A4782F175F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FD645D4C-9DC8-4603-A77B-8A4782F175F4}.Debug|Any CPU.Build.0 = Debug|Any CPU {FD645D4C-9DC8-4603-A77B-8A4782F175F4}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -634,6 +623,33 @@ Global {83C963FD-DC23-46E8-9545-F56197164810}.Release|x64.Build.0 = Release|Any CPU {83C963FD-DC23-46E8-9545-F56197164810}.Release|x86.ActiveCfg = Release|Any CPU {83C963FD-DC23-46E8-9545-F56197164810}.Release|x86.Build.0 = Release|Any CPU + {C852237E-6FE2-4507-953F-77FD72962445}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C852237E-6FE2-4507-953F-77FD72962445}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C852237E-6FE2-4507-953F-77FD72962445}.Debug|x64.ActiveCfg = Debug|Any CPU + {C852237E-6FE2-4507-953F-77FD72962445}.Debug|x64.Build.0 = Debug|Any CPU + {C852237E-6FE2-4507-953F-77FD72962445}.Debug|x86.ActiveCfg = Debug|Any CPU + {C852237E-6FE2-4507-953F-77FD72962445}.Debug|x86.Build.0 = Debug|Any CPU + {C852237E-6FE2-4507-953F-77FD72962445}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C852237E-6FE2-4507-953F-77FD72962445}.Release|Any CPU.Build.0 = Release|Any CPU + {C852237E-6FE2-4507-953F-77FD72962445}.Release|x64.ActiveCfg = Release|Any CPU + {C852237E-6FE2-4507-953F-77FD72962445}.Release|x64.Build.0 = Release|Any CPU + {C852237E-6FE2-4507-953F-77FD72962445}.Release|x86.ActiveCfg = Release|Any CPU + {C852237E-6FE2-4507-953F-77FD72962445}.Release|x86.Build.0 = Release|Any CPU + {D89F9F5D-C56A-4412-AEC1-9AD018322387}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D89F9F5D-C56A-4412-AEC1-9AD018322387}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D89F9F5D-C56A-4412-AEC1-9AD018322387}.Debug|x64.ActiveCfg = Debug|Any CPU + {D89F9F5D-C56A-4412-AEC1-9AD018322387}.Debug|x64.Build.0 = Debug|Any CPU + {D89F9F5D-C56A-4412-AEC1-9AD018322387}.Debug|x86.ActiveCfg = Debug|Any CPU + {D89F9F5D-C56A-4412-AEC1-9AD018322387}.Debug|x86.Build.0 = Debug|Any CPU + {D89F9F5D-C56A-4412-AEC1-9AD018322387}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D89F9F5D-C56A-4412-AEC1-9AD018322387}.Release|Any CPU.Build.0 = Release|Any CPU + {D89F9F5D-C56A-4412-AEC1-9AD018322387}.Release|x64.ActiveCfg = Release|Any CPU + {D89F9F5D-C56A-4412-AEC1-9AD018322387}.Release|x64.Build.0 = Release|Any CPU + {D89F9F5D-C56A-4412-AEC1-9AD018322387}.Release|x86.ActiveCfg = Release|Any CPU + {D89F9F5D-C56A-4412-AEC1-9AD018322387}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {57860CA2-0054-465E-BD1E-024FF8D81354} = {56555FB0-B513-49EF-9002-A5AF135EA090} @@ -679,5 +695,7 @@ Global {7BEA7878-B5BA-4480-BC56-2F7B836F64B9} = {56555FB0-B513-49EF-9002-A5AF135EA090} {38FFE1DF-4B49-40C1-9908-51860BCF2D3E} = {56555FB0-B513-49EF-9002-A5AF135EA090} {83C963FD-DC23-46E8-9545-F56197164810} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {C852237E-6FE2-4507-953F-77FD72962445} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {D89F9F5D-C56A-4412-AEC1-9AD018322387} = {56555FB0-B513-49EF-9002-A5AF135EA090} EndGlobalSection EndGlobal diff --git a/Cvicenie_cykly/Cvicenie_cykly.csproj b/Cvicenie_cykly/Cvicenie_cykly.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/Cvicenie_cykly/Cvicenie_cykly.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/Cvicenie_cykly/Program.cs b/Cvicenie_cykly/Program.cs new file mode 100644 index 00000000..108974cf --- /dev/null +++ b/Cvicenie_cykly/Program.cs @@ -0,0 +1,131 @@ +using System.Data; +using System.Threading.Channels; + +namespace Cvicenie_cykly +{ + internal class Program + { + static void Main(string[] args) + { + /* + Console.WriteLine("1"); + Console.WriteLine("2"); + Console.WriteLine("3"); + Console.WriteLine("4"); + Console.WriteLine("5"); + Console.WriteLine("6"); + Console.WriteLine("7"); + Console.WriteLine("8"); + Console.WriteLine("9"); + Console.WriteLine("10");*/ + /*for (int i = 100; i >= 0; i--) + { + Console.WriteLine(i); + } + */ + + /* + while (true) + { + string input = Console.ReadLine(); + + if (input == "okej") + { + Console.WriteLine("ahoj"); + } + else if (input == "exit") + { + break; + } + + + + + + while (true) + { + string input = Console.ReadLine(); + + if (input == "pozdrav") + { + Console.WriteLine("ahoj"); + } + else if (input == "exit") + { + break; + } + + + } + + + }*/ + + /* + while (true) + { + while (true) + { + string input = Console.ReadLine(); + + if (input == "exit") + { + break; + } + + Console.WriteLine("michal"); + + + + + string inputdva = Console.ReadLine(); + + + + if (inputdva == "exit2") + { + break; + } + + Console.WriteLine("igor"); + + + + } + + + + } + + */ + + Console.Write("znak "); + string znak = Console.ReadLine(); + + Console.Write("aky velky "); + int pocetRiadkov = int.Parse(Console.ReadLine()); + + for (int i = 1; i <= pocetRiadkov; i++) + { + string row = ""; + for (int j = 1; j <= i; j++) + { + row += znak; + } + Console.WriteLine(row); + + + + + + + + + + + + } + + } + } +} diff --git a/cvicenia_poli/Program.cs b/cvicenia_poli/Program.cs new file mode 100644 index 00000000..246494ce --- /dev/null +++ b/cvicenia_poli/Program.cs @@ -0,0 +1,56 @@ +namespace cvicenia_poli +{ + internal class Program + { + static void Main(string[] args) + { + /* int[] numbers = new int[7]; + + numbers[0] = 10; + numbers[1] = 15; + numbers[2] = 35; + numbers[3] = 48; + numbers[4] = 2; + numbers[5] = 1; + numbers[6] = 19; + + Console.WriteLine(numbers[0]); + Console.WriteLine(numbers[1]); + Console.WriteLine(numbers[2]); + Console.WriteLine(numbers[3]); + Console.WriteLine(numbers[4]); + Console.WriteLine(numbers[5]); + Console.WriteLine(numbers[6]); + + /*int sum = 0; + for (int i = 0; i < numbers.Length; i++) + { + Console.WriteLine(numbers[i]); + sum += numbers[i]; + } + Console.WriteLine(sum);*/ + Console.Write("Koľko čísel chceš zadať? "); + int howmutch = int.Parse(Console.ReadLine()); + + int[] numbers = new int[howmutch]; + + + for (int i = 0; i < howmutch; i++) // cyklus 5 krát + { + Console.Write("zadaj cislo: "); + numbers[i] = int.Parse(Console.ReadLine()); // načítaj číslo a ulož do poľa + } + + int sum = 0; + for (int i = 0; i < numbers.Length; i++) + { + Console.WriteLine(numbers[i]); + sum += numbers[i]; + } + Console.WriteLine(sum); + + + + } + } +} diff --git a/cvicenia_poli/cvicenia_poli.csproj b/cvicenia_poli/cvicenia_poli.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/cvicenia_poli/cvicenia_poli.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/src/AppsLab-005-DataTypes/Program.cs b/src/AppsLab-005-DataTypes/Program.cs index e734c745..83d7a78b 100644 --- a/src/AppsLab-005-DataTypes/Program.cs +++ b/src/AppsLab-005-DataTypes/Program.cs @@ -1,5 +1,6 @@  using System; +using System.ComponentModel.Design; namespace MyApp { @@ -7,10 +8,10 @@ internal class Program { static void Main(string[] args) { - - bool isChild = true; + + /* bool isChild = true; Console.WriteLine(isChild); - + int myage = 6; Console.WriteLine(myage); @@ -30,25 +31,127 @@ static void Main(string[] args) int sum = a / b; Console.WriteLine(sum);*/ - - int birthday = 28; - int birthmonth = 3; - int birthyeart = 2010; - - int birthsum = birthday + birthmonth + birthyeart; - Console.WriteLine(birthsum); + /* int birthday = 28; + int birthmonth = 3; + int birthyeart = 2010; + + + int birthsum = birthday + birthmonth + birthyeart; + Console.WriteLine(birthsum); + + Console.WriteLine(birthsum * 10); + + Console.WriteLine(birthyeart * birthmonth + birthday); + Console.WriteLine(name + (birthday + birthmonth)); + /* Console.WriteLine(5f/3f); + */ + + + + + + /* Console.WriteLine("zadaj meno"); + string meno = Console.ReadLine(); + string vypis = "ahoj "; + Console.WriteLine("zadaj vek"); + int vek = int.Parse(Console.ReadLine()); + int rok = 2025; + int roknarodenia = vek - rok; + string skar =" toto je tvoj rok narodenia"; + Console.WriteLine(vypis + meno + skar + roknarodenia);*/ + + + + + + + /*namespace MyApp + { + internal class Program + { + static void Main(string[] args) + + { + /* bool isChild = true; + Console.WriteLine(isChild); + + int myage = 6; + Console.WriteLine(myage); - Console.WriteLine(birthsum * 10); + float pi = 3.14f; + Console.WriteLine(pi); + + string name = "matus"; + Console.WriteLine(name); + + char gender = 'm'; + Console.WriteLine(gender); + + + /* int a = 10; + int b = 5; + + + int sum = a / b; + Console.WriteLine(sum);*/ + + /* int birthday = 28; + int birthmonth = 3; + int birthyeart = 2010; + + + int birthsum = birthday + birthmonth + birthyeart; + Console.WriteLine(birthsum); + + Console.WriteLine(birthsum * 10); + + Console.WriteLine(birthyeart * birthmonth + birthday); + Console.WriteLine(name + (birthday + birthmonth)); + /* Console.WriteLine(5f/3f); + */ + + + + + + /* Console.WriteLine("zadaj meno") + string meno = Console.ReadLine() + string vypis = "ahoj " + Console.WriteLine("zadaj vek") + int vek = int.Parse(Console.ReadLine()) + int rok = 2025 + int roknarodenia = vek - rok + string skar =" toto je tvoj rok narodenia" + Console.WriteLine(vypis + meno + skar + roknarodenia)*/ + + /*Console.WriteLine("zadaj vek") + int vek = int.Parse(Console.ReadLine() + int rok = 2025 + int roknarodenia = vek - rok + hztppp + + if (roknarodenia >= 2007) + { + Console.WriteLine("Nemaš 18 bro chod preč") + } + else + { + Console.WriteLine("welcome") + } + */ + + + Console.WriteLine("napiš čislo prve"); + string kra =Console.ReadLine(); + Console.WriteLine("napiš druhe čislo"); + - Console.WriteLine(birthyeart * birthmonth + birthday); - /* Console.WriteLine(5f/3f); - */ - Console.WriteLine(name + (birthday + birthmonth)); } } -} \ No newline at end of file +} + From e89478106ced79844a8f8075f4c029ddb3c4ea08 Mon Sep 17 00:00:00 2001 From: Moskalm25 Date: Wed, 8 Oct 2025 13:12:04 +0200 Subject: [PATCH 05/16] cicenie --- AppsLab.CSharp.Exercises.sln | 15 +++ ConsoleApp1/ConsoleApp1.csproj | 10 ++ ConsoleApp1/Program.cs | 171 +++++++++++++++++++++++++++++++++ cvicenia_poli/Program.cs | 38 +++++++- 4 files changed, 232 insertions(+), 2 deletions(-) create mode 100644 ConsoleApp1/ConsoleApp1.csproj create mode 100644 ConsoleApp1/Program.cs diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index dfb755ed..85acd455 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -97,6 +97,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cvicenie_cykly", "Cvicenie_ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cvicenia_poli", "cvicenia_poli\cvicenia_poli.csproj", "{D89F9F5D-C56A-4412-AEC1-9AD018322387}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{D2FF1F08-A167-4272-A0E9-4460A5D7468F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -647,6 +649,18 @@ Global {D89F9F5D-C56A-4412-AEC1-9AD018322387}.Release|x64.Build.0 = Release|Any CPU {D89F9F5D-C56A-4412-AEC1-9AD018322387}.Release|x86.ActiveCfg = Release|Any CPU {D89F9F5D-C56A-4412-AEC1-9AD018322387}.Release|x86.Build.0 = Release|Any CPU + {D2FF1F08-A167-4272-A0E9-4460A5D7468F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D2FF1F08-A167-4272-A0E9-4460A5D7468F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D2FF1F08-A167-4272-A0E9-4460A5D7468F}.Debug|x64.ActiveCfg = Debug|Any CPU + {D2FF1F08-A167-4272-A0E9-4460A5D7468F}.Debug|x64.Build.0 = Debug|Any CPU + {D2FF1F08-A167-4272-A0E9-4460A5D7468F}.Debug|x86.ActiveCfg = Debug|Any CPU + {D2FF1F08-A167-4272-A0E9-4460A5D7468F}.Debug|x86.Build.0 = Debug|Any CPU + {D2FF1F08-A167-4272-A0E9-4460A5D7468F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D2FF1F08-A167-4272-A0E9-4460A5D7468F}.Release|Any CPU.Build.0 = Release|Any CPU + {D2FF1F08-A167-4272-A0E9-4460A5D7468F}.Release|x64.ActiveCfg = Release|Any CPU + {D2FF1F08-A167-4272-A0E9-4460A5D7468F}.Release|x64.Build.0 = Release|Any CPU + {D2FF1F08-A167-4272-A0E9-4460A5D7468F}.Release|x86.ActiveCfg = Release|Any CPU + {D2FF1F08-A167-4272-A0E9-4460A5D7468F}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -697,5 +711,6 @@ Global {83C963FD-DC23-46E8-9545-F56197164810} = {56555FB0-B513-49EF-9002-A5AF135EA090} {C852237E-6FE2-4507-953F-77FD72962445} = {56555FB0-B513-49EF-9002-A5AF135EA090} {D89F9F5D-C56A-4412-AEC1-9AD018322387} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {D2FF1F08-A167-4272-A0E9-4460A5D7468F} = {56555FB0-B513-49EF-9002-A5AF135EA090} EndGlobalSection EndGlobal diff --git a/ConsoleApp1/ConsoleApp1.csproj b/ConsoleApp1/ConsoleApp1.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/ConsoleApp1/ConsoleApp1.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/ConsoleApp1/Program.cs b/ConsoleApp1/Program.cs new file mode 100644 index 00000000..153a6f95 --- /dev/null +++ b/ConsoleApp1/Program.cs @@ -0,0 +1,171 @@ +using System.Diagnostics.CodeAnalysis; +using System.Globalization; + +namespace cvicenie_8._10_ +{ + internal class Program + { + static void Main(string[] args) + { + List numbers = new List(); + + + while (true) + { + string command = Console.ReadLine(); + if (command == "ADD") + { + string numberText = Console.ReadLine(); + int number = int.Parse(numberText); + numbers.Add(number); + } + + if (command == "DEL") + { + string numberText = Console.ReadLine(); + int number = int.Parse(numberText); + numbers.Remove(number); + + } + + if (command == "DELI") + { + string numberText = Console.ReadLine(); + int number = int.Parse(numberText); + + int MaxIndex = numbers.Count - 1; + if (number <= MaxIndex) + { + numbers.RemoveAt(number); + } + else + { + Console.WriteLine("zly index"); + } + + } + + if (command == "HAS") + { + string numberText = Console.ReadLine(); + int number = int.Parse(numberText); + bool Contains = numbers.Contains(number); + if (Contains) + { + Console.WriteLine("ANO"); + } + + else + { + Console.WriteLine("NIE"); + } + + } + + if (command == "LIST") + { + foreach (int number in numbers) + { + Console.WriteLine(number); + } + } + if (command == "COUNT") + + { + int sum = numbers.Sum(); + Console.WriteLine(sum); + } + + else if (command == "END") + { + break; + } + + } + + + string command = Console.ReadLine(); + switch (command) + { + case "ADD": + { + string numberText = Console.ReadLine(); + int number = int.Parse(numberText); + numbers.Add(number); + break; + } + case "DEL": + { + string numberText = Console.ReadLine(); + int number = int.Parse(numberText); + numbers.Remove(number); + break; + } + case "DELI": + { + string numberText = Console.ReadLine(); + int number = int.Parse(numberText); + + int MaxIndex = numbers.Count - 1; + if (number <= MaxIndex) + { + numbers.RemoveAt(number); + } + else + { + Console.WriteLine("zly index"); + } + + break; + } + case "HAS": + { + string numberText = Console.ReadLine(); + int number = int.Parse(numberText); + bool Contains = numbers.Contains(number); + if (Contains) + { + Console.WriteLine("ANO"); + } + + else + { + Console.WriteLine("NIE"); + } + + break; + } + case "LIST": + { + foreach (int number in numbers) + { + Console.WriteLine(number); + + } + break; + } + case "COUNT": + { + int sum = numbers.Sum(); + Console.WriteLine(sum); + } + } + + + + + + + } + + } +} + + + + + + + + + diff --git a/cvicenia_poli/Program.cs b/cvicenia_poli/Program.cs index 246494ce..51662cb3 100644 --- a/cvicenia_poli/Program.cs +++ b/cvicenia_poli/Program.cs @@ -29,7 +29,7 @@ static void Main(string[] args) sum += numbers[i]; } Console.WriteLine(sum);*/ - Console.Write("Koľko čísel chceš zadať? "); + /* Console.Write("Koľko čísel chceš zadať? "); int howmutch = int.Parse(Console.ReadLine()); int[] numbers = new int[howmutch]; @@ -47,7 +47,41 @@ static void Main(string[] args) Console.WriteLine(numbers[i]); sum += numbers[i]; } - Console.WriteLine(sum); + Console.WriteLine(sum); */ + + /*int[] numbers = new int[11]; + for (int i = 0; i < numbers.Length; i++) + { + numbers[i] = i * 10; + + } + int[] numbersnew = new int[numbers.Length+1]; + for (int i = 0;i < numbers.Length;i++) + { + numbersnew[i] = numbers[1]; + } + numbersnew[10] = 10000; + foreach (var i in numbersnew) { + + Console.WriteLine(1); + + } + + string[] names = { }*/ + + + + + + + + + + + + + + From 9f008f4dc9c4445465a2b70ac7ae3b19b987e79b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=BA=C5=A1-pc?= Date: Tue, 21 Oct 2025 23:34:35 +0200 Subject: [PATCH 06/16] zadanie --- AppsLab.CSharp.Exercises.sln | 15 +++++++ Homework/Homework.csproj | 10 +++++ Homework/Program.cs | 84 ++++++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+) create mode 100644 Homework/Homework.csproj create mode 100644 Homework/Program.cs diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 85acd455..865340f3 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -99,6 +99,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cvicenia_poli", "cvicenia_p EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{D2FF1F08-A167-4272-A0E9-4460A5D7468F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Homework", "Homework\Homework.csproj", "{489919B1-218E-4E0A-AB84-9FF5B693465D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -661,6 +663,18 @@ Global {D2FF1F08-A167-4272-A0E9-4460A5D7468F}.Release|x64.Build.0 = Release|Any CPU {D2FF1F08-A167-4272-A0E9-4460A5D7468F}.Release|x86.ActiveCfg = Release|Any CPU {D2FF1F08-A167-4272-A0E9-4460A5D7468F}.Release|x86.Build.0 = Release|Any CPU + {489919B1-218E-4E0A-AB84-9FF5B693465D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {489919B1-218E-4E0A-AB84-9FF5B693465D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {489919B1-218E-4E0A-AB84-9FF5B693465D}.Debug|x64.ActiveCfg = Debug|Any CPU + {489919B1-218E-4E0A-AB84-9FF5B693465D}.Debug|x64.Build.0 = Debug|Any CPU + {489919B1-218E-4E0A-AB84-9FF5B693465D}.Debug|x86.ActiveCfg = Debug|Any CPU + {489919B1-218E-4E0A-AB84-9FF5B693465D}.Debug|x86.Build.0 = Debug|Any CPU + {489919B1-218E-4E0A-AB84-9FF5B693465D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {489919B1-218E-4E0A-AB84-9FF5B693465D}.Release|Any CPU.Build.0 = Release|Any CPU + {489919B1-218E-4E0A-AB84-9FF5B693465D}.Release|x64.ActiveCfg = Release|Any CPU + {489919B1-218E-4E0A-AB84-9FF5B693465D}.Release|x64.Build.0 = Release|Any CPU + {489919B1-218E-4E0A-AB84-9FF5B693465D}.Release|x86.ActiveCfg = Release|Any CPU + {489919B1-218E-4E0A-AB84-9FF5B693465D}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -712,5 +726,6 @@ Global {C852237E-6FE2-4507-953F-77FD72962445} = {56555FB0-B513-49EF-9002-A5AF135EA090} {D89F9F5D-C56A-4412-AEC1-9AD018322387} = {56555FB0-B513-49EF-9002-A5AF135EA090} {D2FF1F08-A167-4272-A0E9-4460A5D7468F} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {489919B1-218E-4E0A-AB84-9FF5B693465D} = {56555FB0-B513-49EF-9002-A5AF135EA090} EndGlobalSection EndGlobal diff --git a/Homework/Homework.csproj b/Homework/Homework.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/Homework/Homework.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/Homework/Program.cs b/Homework/Program.cs new file mode 100644 index 00000000..2148233a --- /dev/null +++ b/Homework/Program.cs @@ -0,0 +1,84 @@ +using static System.Net.Mime.MediaTypeNames; + +namespace Cvicenie_Subor +{ + class Program + { + static void Main() + { + string[] text = File.ReadAllLines("People_100.csv"); + + /*MoneyCountAverage(text); + WriteRodneCislo(text); + MinMoneyCount(text);*/ + + List mojZoznam = PeopleUnder05M(text); + //vypisanie vsetkych ludi z mojZoznam + } + + public static void MoneyCountAverage(string[] text) + { + int sum = 0; + foreach (string line in text.Skip(1)) + { + //Martin,Urban,690602/2315,Presov,463102,slobodny + string[] splits = line.Split(","); + //prekonvertovanie hodnoty z retazca na cislo + int accountValue = int.Parse(splits[4]); + //scitanie int hodnoty so sum-om + sum += accountValue; + } + Console.WriteLine(sum / (text.Count() - 1)); + } + public static void WriteRodneCislo(string[] text) + { + foreach (string line in text.Skip(1)) + { + //Martin,Urban,690602/2315,Presov,463102,slobodny + string[] splits = line.Split(","); + string birthNumber = splits[2]; + Console.WriteLine(birthNumber); + } + } + public static void MinMoneyCount(string[] text) + { + int minValue = 9999999; + string minValuePerson = ""; + foreach (string line in text.Skip(1)) + { + //Martin,Urban,690602/2315,Presov,463102,slobodny + string[] splits = line.Split(","); + //prekonvertovanie hodnoty z retazca na cislo + int accountValue = int.Parse(splits[4]); + if (accountValue < minValue) + { + minValue = accountValue; + minValuePerson = splits[0] + " " + splits[1]; + } + } + Console.WriteLine(minValuePerson); + } + + //V TEJTO METODE NEMOZE BYT CONSOLE.WRITELINE + public static List PeopleUnder05M(string[] text) + { + //vytvorenie prazdneho listu pre ludi ktory budu mat menej ako 500 000 na ucte + List peopleWithUnder05M = new List(); + foreach (string line in text.Skip(1)) + { + //splitnut riadok + //najst kolko ma na ucte penazi + //ak ma menej ako 500 000 pridat do listu + } + //vratiti list + return peopleWithUnder05M; + + + + + + + } + + } +} \ No newline at end of file From 6e8a93457dea14e50367b9f8d1c4eecb4cafb2aa Mon Sep 17 00:00:00 2001 From: Moskalm25 Date: Wed, 29 Oct 2025 12:50:51 +0100 Subject: [PATCH 07/16] idem to robit vo vlaku --- AppsLab.CSharp.Exercises.sln | 30 +++++++++++++ Bettlesimulator/Bettlesimulator.csproj | 10 +++++ Bettlesimulator/Program.cs | 38 +++++++++++++++++ Bettlesimulator/hero.cs | 23 ++++++++++ Bettlesimulator/monster.cs | 27 ++++++++++++ cvicenie_objekty/Program.cs | 48 +++++++++++++++++++++ cvicenie_objekty/cvicenie_objekty.csproj | 10 +++++ cvicenie_objekty/student.cs | 54 ++++++++++++++++++++++++ 8 files changed, 240 insertions(+) create mode 100644 Bettlesimulator/Bettlesimulator.csproj create mode 100644 Bettlesimulator/Program.cs create mode 100644 Bettlesimulator/hero.cs create mode 100644 Bettlesimulator/monster.cs create mode 100644 cvicenie_objekty/Program.cs create mode 100644 cvicenie_objekty/cvicenie_objekty.csproj create mode 100644 cvicenie_objekty/student.cs diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 85acd455..10706dbd 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -99,6 +99,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cvicenia_poli", "cvicenia_p EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{D2FF1F08-A167-4272-A0E9-4460A5D7468F}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cvicenie_objekty", "cvicenie_objekty\cvicenie_objekty.csproj", "{66026C75-AC39-4F61-B53C-AE11FFCB3DB1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bettlesimulator", "Bettlesimulator\Bettlesimulator.csproj", "{D6206AD6-9E73-4BC0-B737-485F31648DDA}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -661,6 +665,30 @@ Global {D2FF1F08-A167-4272-A0E9-4460A5D7468F}.Release|x64.Build.0 = Release|Any CPU {D2FF1F08-A167-4272-A0E9-4460A5D7468F}.Release|x86.ActiveCfg = Release|Any CPU {D2FF1F08-A167-4272-A0E9-4460A5D7468F}.Release|x86.Build.0 = Release|Any CPU + {66026C75-AC39-4F61-B53C-AE11FFCB3DB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {66026C75-AC39-4F61-B53C-AE11FFCB3DB1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {66026C75-AC39-4F61-B53C-AE11FFCB3DB1}.Debug|x64.ActiveCfg = Debug|Any CPU + {66026C75-AC39-4F61-B53C-AE11FFCB3DB1}.Debug|x64.Build.0 = Debug|Any CPU + {66026C75-AC39-4F61-B53C-AE11FFCB3DB1}.Debug|x86.ActiveCfg = Debug|Any CPU + {66026C75-AC39-4F61-B53C-AE11FFCB3DB1}.Debug|x86.Build.0 = Debug|Any CPU + {66026C75-AC39-4F61-B53C-AE11FFCB3DB1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {66026C75-AC39-4F61-B53C-AE11FFCB3DB1}.Release|Any CPU.Build.0 = Release|Any CPU + {66026C75-AC39-4F61-B53C-AE11FFCB3DB1}.Release|x64.ActiveCfg = Release|Any CPU + {66026C75-AC39-4F61-B53C-AE11FFCB3DB1}.Release|x64.Build.0 = Release|Any CPU + {66026C75-AC39-4F61-B53C-AE11FFCB3DB1}.Release|x86.ActiveCfg = Release|Any CPU + {66026C75-AC39-4F61-B53C-AE11FFCB3DB1}.Release|x86.Build.0 = Release|Any CPU + {D6206AD6-9E73-4BC0-B737-485F31648DDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D6206AD6-9E73-4BC0-B737-485F31648DDA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D6206AD6-9E73-4BC0-B737-485F31648DDA}.Debug|x64.ActiveCfg = Debug|Any CPU + {D6206AD6-9E73-4BC0-B737-485F31648DDA}.Debug|x64.Build.0 = Debug|Any CPU + {D6206AD6-9E73-4BC0-B737-485F31648DDA}.Debug|x86.ActiveCfg = Debug|Any CPU + {D6206AD6-9E73-4BC0-B737-485F31648DDA}.Debug|x86.Build.0 = Debug|Any CPU + {D6206AD6-9E73-4BC0-B737-485F31648DDA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D6206AD6-9E73-4BC0-B737-485F31648DDA}.Release|Any CPU.Build.0 = Release|Any CPU + {D6206AD6-9E73-4BC0-B737-485F31648DDA}.Release|x64.ActiveCfg = Release|Any CPU + {D6206AD6-9E73-4BC0-B737-485F31648DDA}.Release|x64.Build.0 = Release|Any CPU + {D6206AD6-9E73-4BC0-B737-485F31648DDA}.Release|x86.ActiveCfg = Release|Any CPU + {D6206AD6-9E73-4BC0-B737-485F31648DDA}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -712,5 +740,7 @@ Global {C852237E-6FE2-4507-953F-77FD72962445} = {56555FB0-B513-49EF-9002-A5AF135EA090} {D89F9F5D-C56A-4412-AEC1-9AD018322387} = {56555FB0-B513-49EF-9002-A5AF135EA090} {D2FF1F08-A167-4272-A0E9-4460A5D7468F} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {66026C75-AC39-4F61-B53C-AE11FFCB3DB1} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {D6206AD6-9E73-4BC0-B737-485F31648DDA} = {56555FB0-B513-49EF-9002-A5AF135EA090} EndGlobalSection EndGlobal diff --git a/Bettlesimulator/Bettlesimulator.csproj b/Bettlesimulator/Bettlesimulator.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/Bettlesimulator/Bettlesimulator.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/Bettlesimulator/Program.cs b/Bettlesimulator/Program.cs new file mode 100644 index 00000000..eba2952d --- /dev/null +++ b/Bettlesimulator/Program.cs @@ -0,0 +1,38 @@ +using Bettlesimulator; + +namespace Cvicenie_BattleSimulator +{ + internal class Program + { + static void Main(string[] args) + { + Hero ourHero = new Hero(); + Monster monster1 = new Monster("Goblin", 150, 3); + + while (true) + { + //Hero dostal utok od Monstra + monster1.MonsterAttack(ourHero); + + //Monster dostal utok od hrdinu + //monster1.HP = monster1.HP - ourHero.DMG; + ourHero.HeroAttack(monster1); + + Console.WriteLine(ourHero.HP); + Console.WriteLine(monster1.HP); + + if (ourHero.HP <= 0) + { + Console.WriteLine("Hero is dead"); + break; + } + + if (monster1.HP <= 0) + { + Console.WriteLine("Monster is dead"); + break; + } + } + } + } +} \ No newline at end of file diff --git a/Bettlesimulator/hero.cs b/Bettlesimulator/hero.cs new file mode 100644 index 00000000..1faf6f0e --- /dev/null +++ b/Bettlesimulator/hero.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace Bettlesimulator +{ + + public class Hero + { + public string Name { get; set; } = "Arnost"; + public int HP { get; set; } = 100; + public int DMG { get; set; } = 10; + + public bool HeroAttack(Monster monster) + { + monster.HP = monster.HP - this.DMG; + } + } +} + diff --git a/Bettlesimulator/monster.cs b/Bettlesimulator/monster.cs new file mode 100644 index 00000000..7188f03c --- /dev/null +++ b/Bettlesimulator/monster.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Bettlesimulator; + +namespace Cvicenie_BattleSimulator +{ + public class Monster + { + public string RaceType { get; set; } //Monster RaceType (e.g ... Goblin,Orc,Troll) + public int HP { get; set; } + public int DMG { get; set; } + + public Monster(string raceType, int hP, int dMG) + { + RaceType = raceType; + HP = hP; + DMG = dMG; + } + public void MonsterAttack(Hero hero) + { + hero.HP = hero.HP - DMG; + } + } +} \ No newline at end of file diff --git a/cvicenie_objekty/Program.cs b/cvicenie_objekty/Program.cs new file mode 100644 index 00000000..4a0ca971 --- /dev/null +++ b/cvicenie_objekty/Program.cs @@ -0,0 +1,48 @@ +namespace cvicenie_objekty +{ + internal class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello, World!"); + + string name = "Dano Cipko"; + int age = 15; + string addres = "Kysucke nove mesto"; + char sex = 'M'; + + /* string name1 = "Rado"; + int age1 = 15; + string addres1 = "Rudina"; + char sex1 = 'Z';*/ + + student student1 = new student(); + student1.age = age; + student1.addres = addres; + student1.name = name; + student1.sex = sex; + + student student2 = new student(); + student2.age = 15; + student2.addres = "Rudina" ; + student2.name = "rado"; + student2.sex = 'Z'; + + /*student starystudent = student1 ; + student1.name = "peto"; + Console.WriteLine(starystudent.name);*/ + + /* student1.addtoname("Cipko"); + + Console.WriteLine(student1.name);*/ + + + Console.WriteLine(student1.ShowInfo()); + + + + + + } + } +} diff --git a/cvicenie_objekty/cvicenie_objekty.csproj b/cvicenie_objekty/cvicenie_objekty.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/cvicenie_objekty/cvicenie_objekty.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/cvicenie_objekty/student.cs b/cvicenie_objekty/student.cs new file mode 100644 index 00000000..37996a80 --- /dev/null +++ b/cvicenie_objekty/student.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading.Tasks; + +namespace cvicenie_objekty +{ + public class student + { + public int age { get; set; } + public string name { get; set; } + + public string addres { get; set; } + + public char sex { get; set; } + + public bool isadult() + { + if (age >= 18) + { + + return true; + } + else + { + return false; + } + } + public void addtoname(string surname) + { + name += " " + surname; + } + public string ShowInfo() + { + string info = "Meno: " + name + + " vek " + age + + " adresa" + addres + + " pohlavie " + sex; + + return info; + + + + + + + + } + + + } +} From bbb7162ed30f0ce0d357e4344f44c142cd1ff93f Mon Sep 17 00:00:00 2001 From: Moskalm25 Date: Wed, 5 Nov 2025 12:41:36 +0100 Subject: [PATCH 08/16] list --- Bettlesimulator/Program.cs | 27 +++++++----- Bettlesimulator/hero.cs | 29 ++++++++----- Bettlesimulator/monster.cs | 18 +++++--- nahodne menu/Program.cs | 72 ++++++++++++++++++++++++++++++++ nahodne menu/nahodne menu.csproj | 11 +++++ nahodne menu/person.cs | 12 ++++++ random/Program.cs | 31 ++++++++++++++ random/random.csproj | 10 +++++ 8 files changed, 184 insertions(+), 26 deletions(-) create mode 100644 nahodne menu/Program.cs create mode 100644 nahodne menu/nahodne menu.csproj create mode 100644 nahodne menu/person.cs create mode 100644 random/Program.cs create mode 100644 random/random.csproj diff --git a/Bettlesimulator/Program.cs b/Bettlesimulator/Program.cs index eba2952d..91d88dcc 100644 --- a/Bettlesimulator/Program.cs +++ b/Bettlesimulator/Program.cs @@ -1,6 +1,4 @@ -using Bettlesimulator; - -namespace Cvicenie_BattleSimulator +namespace Cvicenie_BattleSimulator { internal class Program { @@ -9,27 +7,34 @@ static void Main(string[] args) Hero ourHero = new Hero(); Monster monster1 = new Monster("Goblin", 150, 3); + while (true) { - //Hero dostal utok od Monstra + //Hero dostal utok od monstra monster1.MonsterAttack(ourHero); + Console.WriteLine("HERO:HP " + ourHero.HP); //Monster dostal utok od hrdinu - //monster1.HP = monster1.HP - ourHero.DMG; - ourHero.HeroAttack(monster1); - - Console.WriteLine(ourHero.HP); - Console.WriteLine(monster1.HP); + bool wasAttack = ourHero.HeroAttack(monster1); + if (wasAttack) + { + Console.WriteLine("MONSTER:HP " + monster1.HP); + } + else + { + Console.WriteLine("---Not enough energy to attack! Restoring energy..."); + Console.WriteLine("HERO:energy " + ourHero.ENG); + } if (ourHero.HP <= 0) { - Console.WriteLine("Hero is dead"); + Console.WriteLine("Hero is dead!"); break; } if (monster1.HP <= 0) { - Console.WriteLine("Monster is dead"); + Console.WriteLine("Monster is dead!"); break; } } diff --git a/Bettlesimulator/hero.cs b/Bettlesimulator/hero.cs index 1faf6f0e..d9672bb9 100644 --- a/Bettlesimulator/hero.cs +++ b/Bettlesimulator/hero.cs @@ -2,22 +2,31 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading; using System.Threading.Tasks; -namespace Bettlesimulator +namespace Cvicenie_BattleSimulator { - - public class Hero + public class Hero { - public string Name { get; set; } = "Arnost"; - public int HP { get; set; } = 100; - public int DMG { get; set; } = 10; + public string Name { get; set; } = "Arnost"; //Hero name + public int HP { get; set; } = 100; //Health points + public int DMG { get; set; } = 10; //Damage + public int ENG { get; set; } = 100; //Energy + public int SHD { get; set; } = 15; //Shield public bool HeroAttack(Monster monster) { - monster.HP = monster.HP - this.DMG; + if (ENG - 20 >= 0) + { + ENG = ENG - 20; //za jeden utok sa odcita 20 energy + monster.HP = monster.HP - DMG; //zrani monstrum + return true; + } + else + { + ENG = ENG + 50; //ak nema dost energy, tak si ju trochu obnovi + return false; + } } } -} - +} \ No newline at end of file diff --git a/Bettlesimulator/monster.cs b/Bettlesimulator/monster.cs index 7188f03c..6f8695ad 100644 --- a/Bettlesimulator/monster.cs +++ b/Bettlesimulator/monster.cs @@ -3,15 +3,14 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using Bettlesimulator; namespace Cvicenie_BattleSimulator { public class Monster { - public string RaceType { get; set; } //Monster RaceType (e.g ... Goblin,Orc,Troll) - public int HP { get; set; } - public int DMG { get; set; } + public string RaceType { get; set; } //Monster race type (e.g., Goblin, Orc, Troll) + public int HP { get; set; } //Health points + public int DMG { get; set; } //Damage public Monster(string raceType, int hP, int dMG) { @@ -19,9 +18,18 @@ public Monster(string raceType, int hP, int dMG) HP = hP; DMG = dMG; } + + public void MonsterAttack(Hero hero) { - hero.HP = hero.HP - DMG; + if (hero.SHD > DMG) + { + hero.HP = hero.HP - 0; + } + else if (hero.SHD < DMG) + { + hero.HP = (hero.SHD + hero.HP) - DMG; + } } } } \ No newline at end of file diff --git a/nahodne menu/Program.cs b/nahodne menu/Program.cs new file mode 100644 index 00000000..ff20334b --- /dev/null +++ b/nahodne menu/Program.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; + +namespace nahodne_mena +{ + internal class Program + { + static void Main(string[] args) + { + var femaleFirstNames = new List + { + "Anna","Mária","Katarína","Zuzana","Lucia","Kristína","Monika","Veronika","Lenka","Petra", + "Michaela","Eva","Jana","Jarmila","Martina","Barbora","Adriana","Alexandra","Alžbeta","Alica", + "Daniela","Diana","Dominika","Natália","Nikola","Nikoleta","Silvia","Simona","Ivana","Iveta", + "Ingrid","Renáta","Gabriela","Miriam","Pavlína","Laura","Karolína","Klára","Tatiana","Tereza", + "Beáta","Bianka","Rebeka","Nela","Ema","Ela","Tamara","Viktória","Zora","Žaneta" + }; + + var maleFirstNames = new List + { + "Peter","Martin","Jozef","Tomáš","Lukáš","Jakub","Michal","Marek","Andrej","Anton", + "Samuel","Dominik","Richard","Róbert","Roman","Patrik","Filip","Juraj","Karol","Daniel", + "Dávid","Adam","Erik","Igor","Ivan","Ľubomír","Pavol","Stanislav","Štefan","Matej", + "Matúš","Vladimír","Viliam","Radovan","Rastislav","Šimon","Sebastián","Eduard","Marián","Gabriel", + "Tobiáš","Boris","Alan","Oliver","Oskar","Leonard","Viktor","Alex","Benjamin","Tadeáš" + }; + + var femaleSurnamesSk = new List + { + "Nováková","Horváthová","Kováčová","Vargová","Tóthová","Nagyová","Molnárová","Szabóová","Lukáčová","Kučerová", + "Poláková","Kráľová","Urbanová","Krajčíová","Kováčiková","Kubišová","Holubová","Benková","Blašková","Mareková", + "Tomášová","Balážová","Farkašová","Bartošová","Šimková","Pavlíková","Michalíková","Černáková","Švecová","Ševčíková", + "Juríková","Hrušková","Chovancová","Rácová","Hudáková","Ondrušová","Sokolová","Pospíšilová","Gašparová","Gregorová", + "Valentová","Ďuricová","Ďurišová","Vavrová","Žáková","Koreňová","Červeňová","Šramková","Mrázová","Mrvová" + }; + + var maleSurnamesSk = new List + { + "Novák","Horváth","Kováč","Varga","Tóth","Nagy","Molnár","Szabó","Lukáč","Kučera", + "Polák","Kráľ","Urban","Krajčí","Kováčik","Kubiš","Holub","Benko","Blaško","Marek", + "Tomáš","Baláž","Farkaš","Bartoš","Šimko","Pavlík","Michalík","Černák","Švec","Ševčík", + "Jurík","Hruška","Chovanec","Rác","Hudák","Ondruš","Sokol","Pospíšil","Gašpar","Gregor", + "Valent","Ďurica","Ďuriš","Vavro","Žák","Koreň","Červeň","Šramko","Mráz","Mrva" + }; + + Random r = new Random(); + + Console.WriteLine("Ženské mená"); + for (int i = 0; i < 10; i++) // napr. 5 náhodných mien + { + string fullName = GetRandomString(femaleFirstNames, r) + " " + GetRandomString(femaleSurnamesSk, r); + Console.WriteLine(fullName); + } + + Console.WriteLine(" Mužské mená "); + for (int i = 0; i <5; i++) + { + string fullName = GetRandomString(maleFirstNames, r) + " " + GetRandomString(maleSurnamesSk, r); + Console.WriteLine(fullName); + } + + Console.ReadLine(); // nech sa konzola nezavrie + } + + public static string GetRandomString(List strings, Random r) + { + int count = strings.Count; + int index = r.Next(count); + return strings[index]; + } + } +} diff --git a/nahodne menu/nahodne menu.csproj b/nahodne menu/nahodne menu.csproj new file mode 100644 index 00000000..6ed2e6ec --- /dev/null +++ b/nahodne menu/nahodne menu.csproj @@ -0,0 +1,11 @@ + + + + Exe + net8.0 + nahodne_menu + enable + enable + + + diff --git a/nahodne menu/person.cs b/nahodne menu/person.cs new file mode 100644 index 00000000..72324b90 --- /dev/null +++ b/nahodne menu/person.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace nahodne_menu +{ + internal class person + { + } +} diff --git a/random/Program.cs b/random/Program.cs new file mode 100644 index 00000000..95ca6643 --- /dev/null +++ b/random/Program.cs @@ -0,0 +1,31 @@ +using System.Reflection.Emit; + +namespace random +{ + internal class Program + { + static void Main(string[] args) + { + int ct = 0; + for (int i = 0; i < 1000; i++) + { + bool result = Prob(); + if (result == true) ; + { + ct++; + + } + } + Console.WriteLine("true bolo: " + ct + " x "); + } + + public static bool Prob() + { + random r = new Random(); + int nahodnecislo = r.Next(0,101); + if (nahodnecislo >= 73) + { + return true; + } + } + } diff --git a/random/random.csproj b/random/random.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/random/random.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + From 7bcaf1842d56f4490c0d5cac8f3038b6a632df40 Mon Sep 17 00:00:00 2001 From: Moskalm25 Date: Wed, 12 Nov 2025 12:28:57 +0100 Subject: [PATCH 09/16] bettle simulator --- Bettlesimulator/Program.cs | 58 ++++++++++++++++------ Bettlesimulator/hero.cs | 82 +++++++++++++++++++++++++++---- Bettlesimulator/monster.cs | 20 +++----- Bettlesimulator/monsterspecial.cs | 29 +++++++++++ 4 files changed, 150 insertions(+), 39 deletions(-) create mode 100644 Bettlesimulator/monsterspecial.cs diff --git a/Bettlesimulator/Program.cs b/Bettlesimulator/Program.cs index 91d88dcc..cc2404af 100644 --- a/Bettlesimulator/Program.cs +++ b/Bettlesimulator/Program.cs @@ -6,36 +6,62 @@ static void Main(string[] args) { Hero ourHero = new Hero(); Monster monster1 = new Monster("Goblin", 150, 3); + Monster monster2 = new Monster("Ork", 200, 5); + Monster monster3 = new Monster("Dragon", 300, 10); + List cisla = new List(); + List monsters = new List(); + monsters.Add(monster1); + monsters.Add(monster2); + monsters.Add(monster3); + + while (true) { + + + + + + + + + + + + + + + + + while (true) { //Hero dostal utok od monstra monster1.MonsterAttack(ourHero); + monster2.MonsterAttack(ourHero); + monster3.MonsterAttack(ourHero); Console.WriteLine("HERO:HP " + ourHero.HP); //Monster dostal utok od hrdinu bool wasAttack = ourHero.HeroAttack(monster1); if (wasAttack) { - Console.WriteLine("MONSTER:HP " + monster1.HP); - } - else - { - Console.WriteLine("---Not enough energy to attack! Restoring energy..."); - Console.WriteLine("HERO:energy " + ourHero.ENG); - } + { + Console.WriteLine("---Not enough energy to attack! Restoring energy..."); + Console.WriteLine("HERO:energy " + ourHero.Eng); + } - if (ourHero.HP <= 0) - { - Console.WriteLine("Hero is dead!"); - break; - } + if (ourHero.HP <= 0) + { + Console.WriteLine("Hero is dead!"); + break; + } - if (monster1.HP <= 0) - { - Console.WriteLine("Monster is dead!"); - break; + if (monster1.HP <= 0) + { + Console.WriteLine("Monster is dead!"); + break; + } } } } diff --git a/Bettlesimulator/hero.cs b/Bettlesimulator/hero.cs index d9672bb9..278f073d 100644 --- a/Bettlesimulator/hero.cs +++ b/Bettlesimulator/hero.cs @@ -3,30 +3,92 @@ using System.Linq; using System.Text; using System.Threading.Tasks; +using static Cvicenie_BattleSimulator.Monster; namespace Cvicenie_BattleSimulator { - public class Hero + internal class Hero { - public string Name { get; set; } = "Arnost"; //Hero name - public int HP { get; set; } = 100; //Health points - public int DMG { get; set; } = 10; //Damage - public int ENG { get; set; } = 100; //Energy - public int SHD { get; set; } = 15; //Shield + public string Name { get; set; } = "Gumkac"; + public int HP { get; set; } = 100; + public int DMG { get; set; } = 10; + + public int Eng { get; set; } = 100; + public int Armor { get; set; } = 15; public bool HeroAttack(Monster monster) { - if (ENG - 20 >= 0) + if (Eng - 20 >= 0) { - ENG = ENG - 20; //za jeden utok sa odcita 20 energy - monster.HP = monster.HP - DMG; //zrani monstrum + Eng -= 20; + monster.HP -= this.DMG; return true; } else + { - ENG = ENG + 50; //ak nema dost energy, tak si ju trochu obnovi + Eng = Eng + 50; return false; } } + public bool HeroAttack2(MonsterSpecial monster2) + { + if (Eng - 20 >= 0) + { + Eng -= 20; + monster2.HP -= this.DMG; + return true; + } + else + + { + Eng = Eng + 50; + return false; + } + } + public void TakeDamage(int damage) + { + int finalDamage = damage - Armor; + + if (finalDamage < 0) + finalDamage = 0; + + HP -= finalDamage; + } + + public bool HeroDMG(Monster monster) + { + if (Eng - 20 >= 0) + { + Eng -= 20; + monster.HP -= this.DMG; + return true; + } + else + { + Eng += 50; + return false; + } + } + + public bool HeroDMG2(MonsterSpecial monster2) + { + if (Eng - 20 >= 0) + { + Eng -= 20; + monster2.HP -= this.DMG; + return true; + } + else + { + Eng += 50; + return false; + } + } + + + + + } } \ No newline at end of file diff --git a/Bettlesimulator/monster.cs b/Bettlesimulator/monster.cs index 6f8695ad..02e629ba 100644 --- a/Bettlesimulator/monster.cs +++ b/Bettlesimulator/monster.cs @@ -6,11 +6,12 @@ namespace Cvicenie_BattleSimulator { - public class Monster + internal class Monster { - public string RaceType { get; set; } //Monster race type (e.g., Goblin, Orc, Troll) - public int HP { get; set; } //Health points - public int DMG { get; set; } //Damage + + public string RaceType { get; set; } + public int HP { get; set; } + public int DMG { get; set; } public Monster(string raceType, int hP, int dMG) { @@ -19,17 +20,10 @@ public Monster(string raceType, int hP, int dMG) DMG = dMG; } - public void MonsterAttack(Hero hero) { - if (hero.SHD > DMG) - { - hero.HP = hero.HP - 0; - } - else if (hero.SHD < DMG) - { - hero.HP = (hero.SHD + hero.HP) - DMG; - } + hero.HP -= this.DMG; } + } } \ No newline at end of file diff --git a/Bettlesimulator/monsterspecial.cs b/Bettlesimulator/monsterspecial.cs new file mode 100644 index 00000000..b8030b18 --- /dev/null +++ b/Bettlesimulator/monsterspecial.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Cvicenie_BattleSimulator +{ + internal class MonsterSpecial + { + public string RaceType { get; set; } + public int HP { get; set; } + public int DMG { get; set; } + + public MonsterSpecial(string raceType, int hp, int dmg) + { + RaceType = raceType; + HP = hp; + DMG = dmg; + } + + public void MonsterAttack(Hero hero) + { + hero.TakeDamage(this.DMG); + this.DMG += 1; + } + } + +} \ No newline at end of file From 44b0f325a60ff4f664d2028acc5fe466947b3cdb Mon Sep 17 00:00:00 2001 From: Moskalm25 Date: Wed, 19 Nov 2025 13:10:51 +0100 Subject: [PATCH 10/16] idle farm simulator --- AppsLab.CSharp.Exercises.sln | 15 ++ .../Cvicenie_idlefarmer.csproj | 10 ++ Cvicenie_idlefarmer/Idlefarmer.cs | 151 ++++++++++++++++++ Cvicenie_idlefarmer/Plant.cs | 47 ++++++ Cvicenie_idlefarmer/Program.cs | 16 ++ 5 files changed, 239 insertions(+) create mode 100644 Cvicenie_idlefarmer/Cvicenie_idlefarmer.csproj create mode 100644 Cvicenie_idlefarmer/Idlefarmer.cs create mode 100644 Cvicenie_idlefarmer/Plant.cs create mode 100644 Cvicenie_idlefarmer/Program.cs diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 10706dbd..13257776 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -103,6 +103,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cvicenie_objekty", "cviceni EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bettlesimulator", "Bettlesimulator\Bettlesimulator.csproj", "{D6206AD6-9E73-4BC0-B737-485F31648DDA}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cvicenie_idlefarmer", "Cvicenie_idlefarmer\Cvicenie_idlefarmer.csproj", "{E6AFBC85-C0F4-4A80-BC34-03982E3D658C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -689,6 +691,18 @@ Global {D6206AD6-9E73-4BC0-B737-485F31648DDA}.Release|x64.Build.0 = Release|Any CPU {D6206AD6-9E73-4BC0-B737-485F31648DDA}.Release|x86.ActiveCfg = Release|Any CPU {D6206AD6-9E73-4BC0-B737-485F31648DDA}.Release|x86.Build.0 = Release|Any CPU + {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Debug|x64.ActiveCfg = Debug|Any CPU + {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Debug|x64.Build.0 = Debug|Any CPU + {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Debug|x86.ActiveCfg = Debug|Any CPU + {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Debug|x86.Build.0 = Debug|Any CPU + {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Release|Any CPU.Build.0 = Release|Any CPU + {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Release|x64.ActiveCfg = Release|Any CPU + {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Release|x64.Build.0 = Release|Any CPU + {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Release|x86.ActiveCfg = Release|Any CPU + {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -742,5 +756,6 @@ Global {D2FF1F08-A167-4272-A0E9-4460A5D7468F} = {56555FB0-B513-49EF-9002-A5AF135EA090} {66026C75-AC39-4F61-B53C-AE11FFCB3DB1} = {56555FB0-B513-49EF-9002-A5AF135EA090} {D6206AD6-9E73-4BC0-B737-485F31648DDA} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {E6AFBC85-C0F4-4A80-BC34-03982E3D658C} = {56555FB0-B513-49EF-9002-A5AF135EA090} EndGlobalSection EndGlobal diff --git a/Cvicenie_idlefarmer/Cvicenie_idlefarmer.csproj b/Cvicenie_idlefarmer/Cvicenie_idlefarmer.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/Cvicenie_idlefarmer/Cvicenie_idlefarmer.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/Cvicenie_idlefarmer/Idlefarmer.cs b/Cvicenie_idlefarmer/Idlefarmer.cs new file mode 100644 index 00000000..66e1fafa --- /dev/null +++ b/Cvicenie_idlefarmer/Idlefarmer.cs @@ -0,0 +1,151 @@ +using System; +using System.Collections.Generic; +using System.Data.SqlTypes; +using System.Drawing; +using System.Linq; +using System.Numerics; +using System.Security.Authentication.ExtendedProtection; +using System.Text; +using System.Threading.Channels; +using System.Threading.Tasks; +using System.Transactions; + +namespace Cvicenie_idlefarmer +{ + public class Idlefarmer + { + + public int plantprice { get; set; } = 5; + public int Money { get; set; } + public Random Randomgenerator { get; set; } = new Random(); + public int Day { get; set; } + public List Field { get; set; } =new List(); + public List storage { get; set; } = new List(); + + + public void startgame() + { + Console.WriteLine("Zacala sa hra"); + Plant cibula = new Plant ("cibula", 5, 10); + Plant pes = new Plant("pes", 40, 8); + Plant uhorka = new Plant("uhorka", 20, 5); + Field.Add(cibula); + Field.Add(pes); + Field.Add(uhorka); + + + while (true) + { + + + Day++; + foreach (Plant plant in Field) + { + plant.Timeinground++; + + + + } + foreach (Plant plant in Field) + { + Console.WriteLine(plant); + + + + } + Listharvest = new List(); + foreach (Plant plant in Field) + { + if (plant.Timeinground >= plant.Timeforharvest) + { + Console.WriteLine("rastlina nam vyrastla:"+plant); + harvest.Add(plant); + } + } + + foreach(Plant plant in harvest) + { + Field.Remove(plant); + storage.Add(plant); + } + Console.WriteLine("koniec dna" + Day); + Console.WriteLine("stav uctu" + Money); + Console.WriteLine("menu"); + Console.WriteLine("novyden=enter"); + Console.WriteLine("1 pridanie rastlinky" + "(" + plantprice +")"); + Console.WriteLine("2 cely storage"); + Console.WriteLine("predaj vsetko(3)"); + + + string input = Console.ReadLine(); + switch (input) + { + case "1": + if (Money < plantprice) + { + Console.WriteLine("si chudobny jak kkt:" + plantprice); + Console.ReadLine(); + break; + } + Plant plant1 = new Plant("zelenina", Randomgenerator.Next(10, 15), Randomgenerator.Next(20, 30)); + + Field.Add(plant1); + plantprice++; + Console.WriteLine("stoji" + plantprice); + break; + case "2": + foreach (Plant plant in storage) + { + Console.WriteLine(plant); + } + Console.ReadLine(); /*stav += plant.Price;|pomoc chatgpt(prompt:ako to hodim do toho aby mi to case vypisal) + */break; + /* Money += stav; + break;*/ + case "3": + int stav = 0; + foreach (Plant plant in storage) + { + stav += plant.Price; + } + + Money += stav * storage.Count; + storage.Clear(); + + Console.WriteLine("predal si storage"); + Console.WriteLine("stav uctu" + Money ); + Console.ReadLine(); + break; + + default: + break; + + } + + + + + + + + Console.Clear(); + + + + + + + } + + + + + + + + + + } + + } +} diff --git a/Cvicenie_idlefarmer/Plant.cs b/Cvicenie_idlefarmer/Plant.cs new file mode 100644 index 00000000..6da15963 --- /dev/null +++ b/Cvicenie_idlefarmer/Plant.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Cvicenie_idlefarmer +{ + public class Plant + { + private string v1; + private int v2; + private int v3; + + public string PlantType { get; set; } + public int Timeforharvest { get; set; } + public int Timeinground { get; set; } + public int Price { get; set; } + + public Plant(string plantType, int timeforharvest, int price) + { + PlantType = plantType; + Timeforharvest = timeforharvest; + + Price = price; + + + + } + + + + public override string ToString() + { + return $"{PlantType} {Timeinground}/{Timeforharvest}({Price}e)"; + { } + + + + + } + + + + } + +} diff --git a/Cvicenie_idlefarmer/Program.cs b/Cvicenie_idlefarmer/Program.cs new file mode 100644 index 00000000..1fb5906c --- /dev/null +++ b/Cvicenie_idlefarmer/Program.cs @@ -0,0 +1,16 @@ +namespace Cvicenie_idlefarmer +{ + internal class Program + { + static void Main(string[] args) + { + Idlefarmer hra = new Idlefarmer(); + hra.startgame(); + + + + + + } + } +} From 3d5f3337bd438b21a79a5a5e71fae8f555784bbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=BA=C5=A1-pc?= Date: Wed, 19 Nov 2025 19:12:24 +0100 Subject: [PATCH 11/16] fixed prompt --- Cvicenie_idlefarmer/Idlefarmer.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Cvicenie_idlefarmer/Idlefarmer.cs b/Cvicenie_idlefarmer/Idlefarmer.cs index 66e1fafa..9841afb5 100644 --- a/Cvicenie_idlefarmer/Idlefarmer.cs +++ b/Cvicenie_idlefarmer/Idlefarmer.cs @@ -83,23 +83,28 @@ public void startgame() case "1": if (Money < plantprice) { - Console.WriteLine("si chudobny jak kkt:" + plantprice); + Console.WriteLine("si chudobny jak kkt: " + plantprice); Console.ReadLine(); break; } - Plant plant1 = new Plant("zelenina", Randomgenerator.Next(10, 15), Randomgenerator.Next(20, 30)); + + Money -= plantprice; + + Plant plant1 = new Plant("zelenina", Randomgenerator.Next(10, 15), Randomgenerator.Next(20, 30)); Field.Add(plant1); + plantprice++; - Console.WriteLine("stoji" + plantprice); + Console.WriteLine("kúpil si rastlinku, zostavajúce peniaze: " + Money); + Console.ReadLine(); break; case "2": foreach (Plant plant in storage) { Console.WriteLine(plant); } - Console.ReadLine(); /*stav += plant.Price;|pomoc chatgpt(prompt:ako to hodim do toho aby mi to case vypisal) - */break; + Console.ReadLine(); /*stav += plant.Price;|pomoc chatgpt(prompt:ako to hodim do toho aby mi to case vypisal) */ + break; /* Money += stav; break;*/ case "3": @@ -108,7 +113,7 @@ public void startgame() { stav += plant.Price; } - + Money += stav * storage.Count; storage.Clear(); From fab54cf74a88e34c8abe0c77d97df194c708a2a6 Mon Sep 17 00:00:00 2001 From: Moskalm25 Date: Wed, 3 Dec 2025 12:51:20 +0100 Subject: [PATCH 12/16] ukladanie --- AppsLab.CSharp.Exercises.sln | 15 +++++++ Cvicenie_ukladanie/Cvicenie_ukladanie.csproj | 10 +++++ Cvicenie_ukladanie/Program.cs | 44 ++++++++++++++++++++ Cvicenie_ukladanie/osoba.cs | 26 ++++++++++++ 4 files changed, 95 insertions(+) create mode 100644 Cvicenie_ukladanie/Cvicenie_ukladanie.csproj create mode 100644 Cvicenie_ukladanie/Program.cs create mode 100644 Cvicenie_ukladanie/osoba.cs diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 13257776..ef761a93 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -105,6 +105,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bettlesimulator", "Bettlesi EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cvicenie_idlefarmer", "Cvicenie_idlefarmer\Cvicenie_idlefarmer.csproj", "{E6AFBC85-C0F4-4A80-BC34-03982E3D658C}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cvicenie_ukladanie", "Cvicenie_ukladanie\Cvicenie_ukladanie.csproj", "{E0C77479-2227-4E3C-9CC1-AC949EEA71A4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -703,6 +705,18 @@ Global {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Release|x64.Build.0 = Release|Any CPU {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Release|x86.ActiveCfg = Release|Any CPU {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Release|x86.Build.0 = Release|Any CPU + {E0C77479-2227-4E3C-9CC1-AC949EEA71A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E0C77479-2227-4E3C-9CC1-AC949EEA71A4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E0C77479-2227-4E3C-9CC1-AC949EEA71A4}.Debug|x64.ActiveCfg = Debug|Any CPU + {E0C77479-2227-4E3C-9CC1-AC949EEA71A4}.Debug|x64.Build.0 = Debug|Any CPU + {E0C77479-2227-4E3C-9CC1-AC949EEA71A4}.Debug|x86.ActiveCfg = Debug|Any CPU + {E0C77479-2227-4E3C-9CC1-AC949EEA71A4}.Debug|x86.Build.0 = Debug|Any CPU + {E0C77479-2227-4E3C-9CC1-AC949EEA71A4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E0C77479-2227-4E3C-9CC1-AC949EEA71A4}.Release|Any CPU.Build.0 = Release|Any CPU + {E0C77479-2227-4E3C-9CC1-AC949EEA71A4}.Release|x64.ActiveCfg = Release|Any CPU + {E0C77479-2227-4E3C-9CC1-AC949EEA71A4}.Release|x64.Build.0 = Release|Any CPU + {E0C77479-2227-4E3C-9CC1-AC949EEA71A4}.Release|x86.ActiveCfg = Release|Any CPU + {E0C77479-2227-4E3C-9CC1-AC949EEA71A4}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -757,5 +771,6 @@ Global {66026C75-AC39-4F61-B53C-AE11FFCB3DB1} = {56555FB0-B513-49EF-9002-A5AF135EA090} {D6206AD6-9E73-4BC0-B737-485F31648DDA} = {56555FB0-B513-49EF-9002-A5AF135EA090} {E6AFBC85-C0F4-4A80-BC34-03982E3D658C} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {E0C77479-2227-4E3C-9CC1-AC949EEA71A4} = {56555FB0-B513-49EF-9002-A5AF135EA090} EndGlobalSection EndGlobal diff --git a/Cvicenie_ukladanie/Cvicenie_ukladanie.csproj b/Cvicenie_ukladanie/Cvicenie_ukladanie.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/Cvicenie_ukladanie/Cvicenie_ukladanie.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/Cvicenie_ukladanie/Program.cs b/Cvicenie_ukladanie/Program.cs new file mode 100644 index 00000000..b937055e --- /dev/null +++ b/Cvicenie_ukladanie/Program.cs @@ -0,0 +1,44 @@ +namespace Cvicenie_ukladanie +{ + internal class Program + { + static void Main(string[] args) + { + Console.WriteLine("Napis co treba:"); + string subor = "osoba.txt"; + string command = Console.ReadLine(); + if (command=="write") + { + osoba osoba1 = new osoba(meno:"igor",vek:45 ); + string line0s = osoba1.udajeodelenelenciarkou(); + File.WriteAllText(subor, line0s); + } + if (command== "read") + { + string[] read = File.ReadAllText(subor); + string[] dataArr = read.Split(','); + string name = dataArr[0]; + int vek = int.Parse(dataArr[1]); + osoba nacitania = new osoba(name,vek); + + } + + /* + osoba osoba1 = new osoba(meno: "igor", vek: 17); + osoba osoba2 = new osoba(meno: "riso", vek: 16); + osoba osoba3 = new osoba(meno: "kastrol", vek: 15); + string line = osoba1.udajeodelenelenciarkou(); + string subor = "osoba.txt"; + + List list = new List(); + string line1 = osoba1.udajeodelenelenciarkou(); + list.Add(line1); + list.Add(osoba2.udajeodelenelenciarkou()); + list.Add(osoba3.udajeodelenelenciarkou()); + + + // File.WriteAllText(subor,line); + */ + } + } +} diff --git a/Cvicenie_ukladanie/osoba.cs b/Cvicenie_ukladanie/osoba.cs new file mode 100644 index 00000000..ef398c2c --- /dev/null +++ b/Cvicenie_ukladanie/osoba.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Cvicenie_ukladanie +{ + public class osoba + { + public string Meno { get; set; } + public int Vek { get; set; } + + public osoba(string meno,int vek ) + { + Meno = meno; + Vek = vek; + } + public string udajeodelenelenciarkou() + { + string line; + line = Meno; + return line; + } + } +} From 3e6775c3146b156bea347d3b91a6b2cd8811923c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=BA=C5=A1-pc?= Date: Wed, 10 Dec 2025 01:29:23 +0100 Subject: [PATCH 13/16] nwm --- AppsLab.CSharp.Exercises.sln | 48 ++++++++ .../Cvicenie_pravdepodobnos\305\245.csproj" | 10 ++ "Cvicenie_pravdepodobnos\305\245/Program.cs" | 46 ++++++++ "Cvicenie_pravdepodobnos\305\245/student.cs" | 21 ++++ Cvicenie_sims/Cvicenie_sims.csproj | 10 ++ Cvicenie_sims/Program.cs | 15 +++ Cvicenie_sims/Simsgame.cs | 76 +++++++++++++ Cvicenie_sims/player.cs | 106 ++++++++++++++++++ cvicenie_gameshop/Item.cs | 22 ++++ cvicenie_gameshop/Program.cs | 25 +++++ cvicenie_gameshop/cvicenie_gameshop.csproj | 10 ++ cvicenie_gameshop/lootgenerator.cs | 74 ++++++++++++ 12 files changed, 463 insertions(+) create mode 100644 "Cvicenie_pravdepodobnos\305\245/Cvicenie_pravdepodobnos\305\245.csproj" create mode 100644 "Cvicenie_pravdepodobnos\305\245/Program.cs" create mode 100644 "Cvicenie_pravdepodobnos\305\245/student.cs" create mode 100644 Cvicenie_sims/Cvicenie_sims.csproj create mode 100644 Cvicenie_sims/Program.cs create mode 100644 Cvicenie_sims/Simsgame.cs create mode 100644 Cvicenie_sims/player.cs create mode 100644 cvicenie_gameshop/Item.cs create mode 100644 cvicenie_gameshop/Program.cs create mode 100644 cvicenie_gameshop/cvicenie_gameshop.csproj create mode 100644 cvicenie_gameshop/lootgenerator.cs diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 13257776..6093b434 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -105,6 +105,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bettlesimulator", "Bettlesi EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cvicenie_idlefarmer", "Cvicenie_idlefarmer\Cvicenie_idlefarmer.csproj", "{E6AFBC85-C0F4-4A80-BC34-03982E3D658C}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cvicenie_pravdepodobnosť", "Cvicenie_pravdepodobnosť\Cvicenie_pravdepodobnosť.csproj", "{B6B66F97-A22F-4A00-A770-4FF4136D8F8D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cvicenie_gameshop", "cvicenie_gameshop\cvicenie_gameshop.csproj", "{F440743E-383A-45A7-93FC-CC0D81666B47}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cvicenie_sims", "Cvicenie_sims\Cvicenie_sims.csproj", "{9813755E-3759-4D95-9794-F213C4535129}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -703,6 +709,42 @@ Global {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Release|x64.Build.0 = Release|Any CPU {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Release|x86.ActiveCfg = Release|Any CPU {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Release|x86.Build.0 = Release|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Debug|x64.ActiveCfg = Debug|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Debug|x64.Build.0 = Debug|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Debug|x86.ActiveCfg = Debug|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Debug|x86.Build.0 = Debug|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Release|Any CPU.Build.0 = Release|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Release|x64.ActiveCfg = Release|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Release|x64.Build.0 = Release|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Release|x86.ActiveCfg = Release|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Release|x86.Build.0 = Release|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Debug|x64.ActiveCfg = Debug|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Debug|x64.Build.0 = Debug|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Debug|x86.ActiveCfg = Debug|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Debug|x86.Build.0 = Debug|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Release|Any CPU.Build.0 = Release|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Release|x64.ActiveCfg = Release|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Release|x64.Build.0 = Release|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Release|x86.ActiveCfg = Release|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Release|x86.Build.0 = Release|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Debug|x64.ActiveCfg = Debug|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Debug|x64.Build.0 = Debug|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Debug|x86.ActiveCfg = Debug|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Debug|x86.Build.0 = Debug|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Release|Any CPU.Build.0 = Release|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Release|x64.ActiveCfg = Release|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Release|x64.Build.0 = Release|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Release|x86.ActiveCfg = Release|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -757,5 +799,11 @@ Global {66026C75-AC39-4F61-B53C-AE11FFCB3DB1} = {56555FB0-B513-49EF-9002-A5AF135EA090} {D6206AD6-9E73-4BC0-B737-485F31648DDA} = {56555FB0-B513-49EF-9002-A5AF135EA090} {E6AFBC85-C0F4-4A80-BC34-03982E3D658C} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {F440743E-383A-45A7-93FC-CC0D81666B47} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {9813755E-3759-4D95-9794-F213C4535129} = {56555FB0-B513-49EF-9002-A5AF135EA090} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4F4D9113-B761-4ACA-A622-94EE662BFFA9} EndGlobalSection EndGlobal diff --git "a/Cvicenie_pravdepodobnos\305\245/Cvicenie_pravdepodobnos\305\245.csproj" "b/Cvicenie_pravdepodobnos\305\245/Cvicenie_pravdepodobnos\305\245.csproj" new file mode 100644 index 00000000..2150e379 --- /dev/null +++ "b/Cvicenie_pravdepodobnos\305\245/Cvicenie_pravdepodobnos\305\245.csproj" @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git "a/Cvicenie_pravdepodobnos\305\245/Program.cs" "b/Cvicenie_pravdepodobnos\305\245/Program.cs" new file mode 100644 index 00000000..02b374e9 --- /dev/null +++ "b/Cvicenie_pravdepodobnos\305\245/Program.cs" @@ -0,0 +1,46 @@ +namespace Cvicenie_pravdepodobnosť +{ + internal class Program + { + static void Main(string[] args) + { + /* Random random = new Random(); + int value = random.Next(1, 100); + if (value < 80) + { + Console.WriteLine("Uspech"); + } + else + { + Console.WriteLine("Neuspech"); + }*/ + + /* student student1 = new student("Janko", 3); + student student2 = new student("Fero", 5); + student student3 = new student("Misko", 2); + student student4 = new student("Palo", 10);*/ + List students = new List(); + students.Add(new student("Janko", 3)); + students.Add(new student("Fero", 5)); + students.Add(new student("Misko", 2)); + students.Add(new student ("matus", 20) ) ; + students.Add(new student("Dano", 7)); + List ticketPool = new List(); + foreach (student stud in students) + { + for (int i = 0; i < stud.Ticketcount; i++) + { + ticketPool.Add(stud); + } + } + Random random = new Random(); + int index = random.Next(0, ticketPool.Count); + student winner = ticketPool[index]; + Console.WriteLine("Vyherca je: " + winner.Name + winner.Ticketcount); + + + + + } + } +} diff --git "a/Cvicenie_pravdepodobnos\305\245/student.cs" "b/Cvicenie_pravdepodobnos\305\245/student.cs" new file mode 100644 index 00000000..9e2a2ca4 --- /dev/null +++ "b/Cvicenie_pravdepodobnos\305\245/student.cs" @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Cvicenie_pravdepodobnosť +{ + public class student + { + public string Name { get; set; } + public int Ticketcount { get; set; } + + + public student(string name, int ticketcount) + { + Name = name; + Ticketcount = ticketcount; + } + } +} diff --git a/Cvicenie_sims/Cvicenie_sims.csproj b/Cvicenie_sims/Cvicenie_sims.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/Cvicenie_sims/Cvicenie_sims.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/Cvicenie_sims/Program.cs b/Cvicenie_sims/Program.cs new file mode 100644 index 00000000..98ced585 --- /dev/null +++ b/Cvicenie_sims/Program.cs @@ -0,0 +1,15 @@ +namespace Cvicenie_sims +{ + internal class Program + { + static void Main(string[] args) + { + + Simsgame simsgame = new Simsgame(); + simsgame.StartGame(); + + + + } + } +} diff --git a/Cvicenie_sims/Simsgame.cs b/Cvicenie_sims/Simsgame.cs new file mode 100644 index 00000000..7f478626 --- /dev/null +++ b/Cvicenie_sims/Simsgame.cs @@ -0,0 +1,76 @@ +using System; +using System.Threading; + +namespace Cvicenie_sims +{ + internal class Simsgame + { + public player myplayer { get; set; } = new player(); + + public void StartGame() + { + bool running = true; + int timer = 0; // počítadlo času + int interval = 3000; // 3 sekundy + int tick = 300; // jeden cyklus menu = 300ms + + while (running) + { + Console.Clear(); + + // ===================== ČASOVÁ SIMULÁCIA ===================== + timer += tick; + if (timer >= interval) + { + timer = 0; // resetujeme čas + myplayer.starving(); + myplayer.thirsting(); + } + + // Ak hráč zomrie → stop + if (myplayer.helth <= 0) + { + Console.WriteLine("Tvoj Sim zomrel. GAME OVER."); + Console.WriteLine(myplayer.Status()); + break; + } + + // =========================== MENU =========================== + Console.WriteLine("===== SIMS MENU ====="); + Console.WriteLine("1 - Pracovať (+20$)"); + Console.WriteLine("2 - Kúpiť jedlo (-10$)"); + Console.WriteLine("3 - Kúpiť vodu (-5$)"); + Console.WriteLine("4 - Zjesť jedlo"); + Console.WriteLine("5 - Napiť sa"); + Console.WriteLine("6 - Status"); + Console.WriteLine("0 - Koniec"); + Console.WriteLine(); + Console.WriteLine("Hlad: " + myplayer.hunger + + " | Smäd: " + myplayer.thirst + + " | Health: " + myplayer.helth); + Console.Write("Vyber: "); + + if (Console.KeyAvailable) + { + string choice = Console.ReadLine(); + Console.Clear(); + + switch (choice) + { + case "1": Console.WriteLine(myplayer.Work()); break; + case "2": Console.WriteLine(myplayer.BuyFood()); break; + case "3": Console.WriteLine(myplayer.BuyWater()); break; + case "4": Console.WriteLine(myplayer.Eat()); break; + case "5": Console.WriteLine(myplayer.Drink()); break; + case "6": Console.WriteLine(myplayer.Status()); break; + case "0": running = false; continue; + default: Console.WriteLine("Neplatná možnosť."); break; + } + } + + + Thread.Sleep(tick); // 300ms cyklus + } + } + } +} diff --git a/Cvicenie_sims/player.cs b/Cvicenie_sims/player.cs new file mode 100644 index 00000000..e1706c28 --- /dev/null +++ b/Cvicenie_sims/player.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Cvicenie_sims +{ + public class player + + { + string name { get; set; } + public int money { get; set; } = 50; + public int hunger { get; set; } = 100; + public int thirst { get; set; } = 100; + public int helth { get; set; } = 100; + public int food { get; set; } = 0; + public int water { get; set; } = 0; + public void starving() + { + hunger -= 5; + if (hunger <= 0) + { + hunger = 0; + helth -= 10; + } + } + + public void thirsting() + { + thirst -= 20; + if (thirst <= 0) + { + thirst = 0; + helth -= 10; + } + } + + // ==================== HRÁČSKE AKCIE ==================== + + public string Work() + { + money += 20; + return $"Pracoval si a zarobil 20$. Máš {money}$"; + } + + public string BuyFood() + { + if (money >= 10) + { + money -= 10; + food++; + return $"Kúpil si jedlo. Jedlá: {food}"; + } + return "Nemáš dosť peňazí!"; + } + + public string BuyWater() + { + if (money >= 5) + { + money -= 5; + water++; + return $"Kúpil si vodu. Vody: {water}"; + } + return "Nemáš dosť peňazí!"; + } + + public string Eat() + { + if (food > 0) + { + food--; + hunger += 25; + if (hunger > 100) hunger = 100; + return $"Zjedol si jedlo. Hunger: {hunger}"; + } + return "Nemáš jedlo!"; + } + + public string Drink() + { + if (water > 0) + { + water--; + thirst += 30; + if (thirst > 100) thirst = 100; + return $"Napil si sa. Thirst: {thirst}"; + } + return "Nemáš vodu!"; + } + public string Status() + { + return + $"Health: {helth}\n" + + $"Hunger: {hunger}\n" + + $"Thirst: {thirst}\n" + + $"Jedlo: {food}\n" + + $"Voda: {water}\n" + + $"Peniaze: {money}$"; + + + + } + } +} diff --git a/cvicenie_gameshop/Item.cs b/cvicenie_gameshop/Item.cs new file mode 100644 index 00000000..4fd6756a --- /dev/null +++ b/cvicenie_gameshop/Item.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace cvicenie_gameshop +{ + public class Item + { + public string Name { get; set; } + public int Price { get; set; } + public int Level { get; set; } + + public override string ToString() + { + return $"{Name} (Hodnota: {Price}, Level: {Level})"; + } + + + } +} diff --git a/cvicenie_gameshop/Program.cs b/cvicenie_gameshop/Program.cs new file mode 100644 index 00000000..11866fd8 --- /dev/null +++ b/cvicenie_gameshop/Program.cs @@ -0,0 +1,25 @@ +using System.Threading.Channels; + +namespace cvicenie_gameshop +{ + internal class Program + { + static void Main(string[] args) + { + List items = lootgenerator.GetRandomLoot(); + Item najdrahsia = items.OrderByDescending(item => item.Price).Skip(1).First(); + + Console.WriteLine("Najdrahší item:" + najdrahsia); + Item najlacnejsia = items.OrderBy(item => item.Price).First(); + Console.WriteLine("Najlacnejši item:" + najlacnejsia); + List ItemsUnder1000 = items.Where(item => item.Price <=1000).ToList(); + Console.WriteLine("Tolko veci tstoji menej jak 1000:" + ItemsUnder1000.Count); + List nad500pod1000 = items.Where(item => item.Price >= 500 && item.Price <= 1000).ToList(); + Console.WriteLine("Veci ktore stoja viac ako 500 a menej ako 1000:" + nad500pod1000.Count); + } + + } + + +} + diff --git a/cvicenie_gameshop/cvicenie_gameshop.csproj b/cvicenie_gameshop/cvicenie_gameshop.csproj new file mode 100644 index 00000000..2150e379 --- /dev/null +++ b/cvicenie_gameshop/cvicenie_gameshop.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/cvicenie_gameshop/lootgenerator.cs b/cvicenie_gameshop/lootgenerator.cs new file mode 100644 index 00000000..fe550a79 --- /dev/null +++ b/cvicenie_gameshop/lootgenerator.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace cvicenie_gameshop +{ + public static class lootgenerator + { + public static List GetRandomLoot() + { + var itemNames = new List + { + "Zafírový amulet", +"Dračí plášť", +"Kúzelné ponožky", +"Elixír neviditeľnosti", +"Plášť tieňov", +"Strieborný roh", +"Temný artefakt", +"Runový zvitok", +"Plameňová koruna", +"Oceľové rukavice", +"Krištáľový prsteň", +"Tajomný medailón", +"Meč bleskov", +"Klenot púšte", +"Prikrývka mrazu", +"Kniha zabudnutých kúziel", +"Hromový halapartník", +"Zlatý pohár", +"Svätožiarová lampa", +"Vírivá dýka", +"Galaktické okuliare", +"Truhlica so záhadou", +"Rubínové topánky", +"Prsteň večnosti", +"Zamatové puzdro", +"Náhrdelník odvahy", +"Maska ilúzií", +"Korunka moci", +"Nefritový fragment", +"Tótem šťastia" + }; + + + var rand = new Random(148752985); + var itemNamesCopy = new List(itemNames); + var result = new List(); + + for (int i = 0; i < 20; i++) + { + int idx = rand.Next(itemNamesCopy.Count); + string name = itemNamesCopy[idx]; + itemNamesCopy.RemoveAt(idx); + + int price = rand.Next(50, 2001); // náhodná cena 50 až 2000 + int level = rand.Next(1, 11); // náhodný level 1 až 10 + + var item = new Item + { + Name = name, + Price = price, + Level = level + }; + + result.Add(item); + } + return result; + } + + } +} From e3103bbc95851c519aa9eb49842c80283a5f1bd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=BA=C5=A1-pc?= Date: Wed, 28 Jan 2026 05:48:53 +0100 Subject: [PATCH 14/16] projekt --- Bettlesimulator/Program.cs | 20 +-- Cvicenie_idlefarmer/Idlefarmer.cs | 8 +- Rpg hra/Game.cs | 211 ++++++++++++++++++++++++++++++ Rpg hra/Hero.cs | 111 ++++++++++++++++ Rpg hra/Monster.cs | 99 ++++++++++++++ Rpg hra/Program.cs | 14 ++ Rpg hra/Rpg hra.csproj | 11 ++ 7 files changed, 451 insertions(+), 23 deletions(-) create mode 100644 Rpg hra/Game.cs create mode 100644 Rpg hra/Hero.cs create mode 100644 Rpg hra/Monster.cs create mode 100644 Rpg hra/Program.cs create mode 100644 Rpg hra/Rpg hra.csproj diff --git a/Bettlesimulator/Program.cs b/Bettlesimulator/Program.cs index cc2404af..50f275d2 100644 --- a/Bettlesimulator/Program.cs +++ b/Bettlesimulator/Program.cs @@ -14,25 +14,7 @@ static void Main(string[] args) monsters.Add(monster2); monsters.Add(monster3); - while (true) { - - - - - - - - - - - - - - - - - - + while (true) { diff --git a/Cvicenie_idlefarmer/Idlefarmer.cs b/Cvicenie_idlefarmer/Idlefarmer.cs index 9841afb5..d1cdbcd5 100644 --- a/Cvicenie_idlefarmer/Idlefarmer.cs +++ b/Cvicenie_idlefarmer/Idlefarmer.cs @@ -69,7 +69,7 @@ public void startgame() storage.Add(plant); } Console.WriteLine("koniec dna" + Day); - Console.WriteLine("stav uctu" + Money); + Console.WriteLine("stav uctu" + Money + "$"); Console.WriteLine("menu"); Console.WriteLine("novyden=enter"); Console.WriteLine("1 pridanie rastlinky" + "(" + plantprice +")"); @@ -83,7 +83,7 @@ public void startgame() case "1": if (Money < plantprice) { - Console.WriteLine("si chudobny jak kkt: " + plantprice); + Console.WriteLine("si chudobny jak kkt maš iba: " + Money + "$"); Console.ReadLine(); break; } @@ -95,7 +95,7 @@ public void startgame() Field.Add(plant1); plantprice++; - Console.WriteLine("kúpil si rastlinku, zostavajúce peniaze: " + Money); + Console.WriteLine("kúpil si rastlinku, zostavajúce peniaze: " + Money + "$"); Console.ReadLine(); break; case "2": @@ -118,7 +118,7 @@ public void startgame() storage.Clear(); Console.WriteLine("predal si storage"); - Console.WriteLine("stav uctu" + Money ); + Console.WriteLine("Stav učtu:" + Money + "$" ); Console.ReadLine(); break; diff --git a/Rpg hra/Game.cs b/Rpg hra/Game.cs new file mode 100644 index 00000000..1df41101 --- /dev/null +++ b/Rpg hra/Game.cs @@ -0,0 +1,211 @@ +using System; +using System.Collections.Generic; + +namespace Rpg_hra +{ + public class Game + { + private Hero hero; + private int fightCount; + private int monsterAttackBonus; + + public Game() + { + fightCount = 0; + monsterAttackBonus = 0; + } + + public void Run() + { + Console.WriteLine("Vitaj v jednoduchej konzolovej RPG hre."); + Console.Write("Zadaj meno hrdinu: "); + string name = Console.ReadLine(); + if (string.IsNullOrWhiteSpace(name)) + { + name = "Hrdina"; + } + + hero = new Hero(name, 200, 50, 10, 2, 20); + + while (true) + { + if (hero.IsDead()) + { + Console.WriteLine("Tvoj hrdina zomrel. Koniec hry."); + break; + } + + fightCount++; + bool isBoss = (fightCount % 5) == 0; + Monster monster = Monster.Create(fightCount, monsterAttackBonus, isBoss); + + Console.WriteLine(""); + Console.WriteLine("--- Súboj " + fightCount + (isBoss ? " (BOSS)" : "")); + // multi-line monster info + Console.WriteLine(monster.Name); + Console.WriteLine("HP: " + monster.Hp); + Console.WriteLine("Útok: " + monster.MinAttack + "-" + monster.MaxAttack); + Console.WriteLine("Odmena: " + monster.Reward + " zl."); + + // bojový cyklus + while (!monster.IsDead() && !hero.IsDead()) + { + Console.WriteLine(""); + // multi-line hero status (uses Hero.GetStatus()) + Console.WriteLine(hero.GetStatus()); + Console.WriteLine(""); + Console.WriteLine(monster.Name + " — HP: " + monster.Hp); + Console.Write("Akcia ([A] Útok, [O] Oddych, [S] Stav): "); + string choice = Console.ReadLine(); + + + choice = choice.ToUpper(); + + if (choice == "S") + { + Console.WriteLine(); + Console.WriteLine(hero.GetStatus()); + continue; + } + + if (choice == "A") + { + if (hero.Energy < Hero.AttackEnergyCost) + { + Console.WriteLine("Nedostatok energie. Musíš oddychovať."); + hero.Rest(); + } + else + { + int dmg = hero.Attack(); + monster.TakeDamage(dmg); + Console.WriteLine("Útok: zranil si " + monster.Name + " za " + dmg + " dmg."); + } + } + else if (choice == "O") + { + hero.Rest(); + Console.WriteLine("Oddych - doplnil si energiu."); + } + else + { + Console.WriteLine("Neplatná voľba."); + continue; + } + + // príšera útočí ak je ešte nažive + if (!monster.IsDead()) + { + int mAtk = monster.Attack(); + int actual = mAtk - hero.TotalDefense(); + if (actual < 0) actual = 0; + hero.TakeDamage(actual); + Console.WriteLine(monster.Name + " útočí za " + mAtk + " dmg. Po zohľadnení obrany prijímaš " + actual + " dmg."); + } + } + + // výsledok súboja + if (hero.IsDead()) + { + if (isBoss) + { + Console.WriteLine("Zomrel si pri boji s bossom - hra sa okamžite končí."); + break; + } + Console.WriteLine("Zomrel si. Koniec hry."); + break; + } + else + { + Console.WriteLine(""); + Console.WriteLine("Porazil si " + monster.Name + " Získavaš " + monster.Reward + " zl."); + hero.Money += monster.Reward; + + if (isBoss) + { + Console.WriteLine("Boss porazený! Dostávaš bonus a príšery zosilnejú."); + int bonus = monster.Reward / 2; + hero.Money += bonus; + Console.WriteLine("Bonus za bossa: +" + bonus + " zl."); + monsterAttackBonus += 2; + } + + // jednoduchý obchod po boji + bool afterFight = true; + while (afterFight) + { + Console.WriteLine(""); + // use multi-line status for after-fight display + Console.WriteLine(hero.GetStatus()); + Console.WriteLine(""); + + // split shop options into separate lines for better readability + Console.WriteLine("Obchod:"); + Console.WriteLine(" [1] Zbraň +5 útok (40 zl)"); + Console.WriteLine(" [2] Brnenie +3 obrana (35 zl)"); + Console.WriteLine(" [3] Elixír energie +30 (20 zl)"); + Console.WriteLine(" [4] Pokračovať"); + Console.WriteLine(" [5] Ukončiť"); + + Console.Write("Voľba: "); + string shop = Console.ReadLine(); + + + if (shop == "1") + { + if (hero.Money >= 40) + { + hero.Money -= 40; + hero.EquipWeapon(5, "Lepšia zbraň"); + Console.WriteLine("Kúpil si zbraň +5 útok."); + } + else + { + Console.WriteLine("Nemáš dosť peňazí."); + } + } + else if (shop == "2") + { + if (hero.Money >= 35) + { + hero.Money -= 35; + hero.EquipArmor(3, "Lepšie brnenie"); + Console.WriteLine("Kúpil si brnenie +3 obrana."); + } + else + { + Console.WriteLine("Nemáš dosť peňazí."); + } + } + else if (shop == "3") + { + if (hero.Money >= 20) + { + hero.Money -= 20; + hero.AddEnergy(30); + Console.WriteLine("Použil si elixír energie."); + } + else + { + Console.WriteLine("Nemáš dosť peňazí."); + } + } + else if (shop == "4") + { + afterFight = false; // pokračovať do ďalšieho boja + } + else if (shop == "5") + { + Console.WriteLine("Ukončujem hru. Vďaka za hranie!"); + return; + } + else + { + Console.WriteLine("Neplatná voľba."); + } + } + } + } + } + } +} diff --git a/Rpg hra/Hero.cs b/Rpg hra/Hero.cs new file mode 100644 index 00000000..18475ef0 --- /dev/null +++ b/Rpg hra/Hero.cs @@ -0,0 +1,111 @@ +using System; + +namespace Rpg_hra +{ + public class Hero + { + public const int AttackEnergyCost = 10; + + public string Name { get; set; } + public int MaxHp { get; set; } + public int Hp { get; set; } + public int MaxEnergy { get; set; } + public int Energy { get; set; } + public int BaseAttack { get; set; } + public int Defense { get; set; } + public int Money { get; set; } + public string WeaponName { get; set; } + public int WeaponAttack { get; set; } + public string ArmorName { get; set; } + public int ArmorDefense { get; set; } + + public Hero(string name, int maxHp, int maxEnergy, int baseAttack, int defense, int money) + { + Name = name; + MaxHp = maxHp; + Hp = maxHp; + MaxEnergy = maxEnergy; + Energy = maxEnergy; + BaseAttack = baseAttack; + Defense = defense; + Money = money; + WeaponName = "None"; + WeaponAttack = 0; + ArmorName = "None"; + ArmorDefense = 0; + } + + public int TotalAttack() + { + return BaseAttack + WeaponAttack; + } + + public int TotalDefense() + { + return Defense + ArmorDefense; + } + + public bool IsDead() + { + return Hp <= 0; + } + + // deterministic attack: costs energy and returns damage + public int Attack() + { + if (Energy < AttackEnergyCost) + { + return 0; + } + + Energy -= AttackEnergyCost; + return TotalAttack(); + } + + public void Rest() + { + // restore some energy (but not hp) + int restored = Math.Max(1, MaxEnergy / 4); + Energy += restored; + if (Energy > MaxEnergy) Energy = MaxEnergy; + } + + public void TakeDamage(int dmg) + { + Hp -= dmg; + if (Hp < 0) Hp = 0; + } + + public void EquipWeapon(int attackBonus, string name) + { + WeaponAttack = attackBonus; + WeaponName = name; + } + + public void EquipArmor(int defBonus, string name) + { + ArmorDefense = defBonus; + ArmorName = name; + } + + public void AddEnergy(int amount) + { + Energy += amount; + if (Energy > MaxEnergy) Energy = MaxEnergy; + } + + public string GetStatus() + { + // No string interpolation ($) — use concatenation so values print correctly + return string.Join(Environment.NewLine, new[] + { + Name, + "HP: " + Hp + "/" + MaxHp, + "Energy: " + Energy + "/" + MaxEnergy, + "ATK: " + TotalAttack() + " (Base " + BaseAttack + " + Weapon " + WeaponAttack + " " + WeaponName + ")", + "DEF: " + TotalDefense() + " (Base " + Defense + " + Armor " + ArmorDefense + " " + ArmorName + ")", + "Money: " + Money + " zl" + }); + } + } +} diff --git a/Rpg hra/Monster.cs b/Rpg hra/Monster.cs new file mode 100644 index 00000000..99cc3b4e --- /dev/null +++ b/Rpg hra/Monster.cs @@ -0,0 +1,99 @@ +using System; + +namespace Rpg_hra +{ + public class Monster + { + private static readonly Random rng = new(); + + public string Name { get; private set; } + public int Hp { get; private set; } + public int MinAttack { get; private set; } + public int MaxAttack { get; private set; } + public int Reward { get; private set; } + public bool IsBoss { get; private set; } + + public Monster(string name, int hp, int minAtk, int maxAtk, int reward, bool isBoss) + { + Name = name; + Hp = hp; + MinAttack = minAtk; + MaxAttack = maxAtk; + Reward = reward; + IsBoss = isBoss; + } + + // Randomized vytváranie príšer + public static Monster Create(int fightIndex, int attackBonus, bool isBoss) + { + if (isBoss) + { + var bosses = new[] + { + new MonsterTemplate("Drak", 150, 18, 26, 100), + new MonsterTemplate("Nekromancer", 140, 16, 24, 90), + new MonsterTemplate("Obor", 160, 20, 28, 110), + new MonsterTemplate("Temný rytier", 130, 15, 22, 95) + }; + + var tpl = bosses[rng.Next(bosses.Length)]; + + // small random variation plus light scaling by fightIndex + int levelScale = Math.Max(0, (fightIndex - 1) / 5); + int hp = tpl.Hp + rng.Next(-15, 16) + levelScale * 10; + int minAtk = tpl.MinAtk + attackBonus + rng.Next(-3, 4) + levelScale; + int maxAtk = tpl.MaxAtk + attackBonus + rng.Next(-3, 4) + levelScale; + int reward = tpl.Reward + rng.Next(-10, 21) + levelScale * 20; + if (hp < 1) hp = 1; + if (minAtk < 1) minAtk = 1; + if (reward < 1) reward = 1; + + return new Monster(tpl.Name, hp, minAtk, maxAtk, reward, true); + } + else + { + string[] types = new string[] { "Goblin", "Vlkolak", "Pavúk", "Bandita", "Skelet" }; + int i = rng.Next(types.Length); + string name = types[i]; + + int[] hpVals = new int[] { 25, 30, 22, 28, 20 }; + int[] minVals = new int[] { 4, 6, 5, 6, 4 }; + int[] maxVals = new int[] { 6, 8, 7, 9, 6 }; + int[] rewards = new int[] { 10, 14, 12, 13, 9 }; + + // random variation and light scaling with fightIndex + int levelScale = Math.Max(0, (fightIndex - 1) / 3); + int hp = hpVals[i] + rng.Next(-5, 6) + levelScale * 3; + int minAtk = minVals[i] + attackBonus + rng.Next(-2, 3) + levelScale; + int maxAtk = maxVals[i] + attackBonus + rng.Next(-2, 3) + levelScale; + int reward = rewards[i] + rng.Next(-3, 6) + levelScale * 2; + if (hp < 1) hp = 1; + if (minAtk < 1) minAtk = 1; + if (reward < 1) reward = 1; + + return new Monster(name, hp, minAtk, maxAtk, reward, false); + } + } + + // Náhodný útok v rámci min-max + public int Attack() + { + if (MinAttack >= MaxAttack) return MinAttack; + return rng.Next(MinAttack, MaxAttack + 1); + } + + public void TakeDamage(int dmg) + { + Hp -= dmg; + if (Hp < 0) Hp = 0; + } + + public bool IsDead() + { + return Hp <= 0; + } + } + + // návrh, vlož do Monster.cs alebo do samostatného súboru + record MonsterTemplate(string Name, int Hp, int MinAtk, int MaxAtk, int Reward); +} diff --git a/Rpg hra/Program.cs b/Rpg hra/Program.cs new file mode 100644 index 00000000..0170d9de --- /dev/null +++ b/Rpg hra/Program.cs @@ -0,0 +1,14 @@ +using System; + +namespace Rpg_hra +{ + internal class Program + { + static void Main(string[] args) + { + Console.OutputEncoding = System.Text.Encoding.UTF8; + var game = new Game(); + game.Run(); + } + } +} diff --git a/Rpg hra/Rpg hra.csproj b/Rpg hra/Rpg hra.csproj new file mode 100644 index 00000000..3e97ca48 --- /dev/null +++ b/Rpg hra/Rpg hra.csproj @@ -0,0 +1,11 @@ + + + + Exe + net8.0 + Rpg_hra + enable + enable + + + From fdf129389262561186303a52b0e75cfca13ae763 Mon Sep 17 00:00:00 2001 From: Moskalm25 Date: Wed, 4 Mar 2026 12:42:59 +0100 Subject: [PATCH 15/16] 4.3.2026 --- AppsLab.CSharp.Exercises.sln | 48 ++++ Cvicenie_minecraft Wpf/App.xaml | 9 + Cvicenie_minecraft Wpf/App.xaml.cs | 14 ++ Cvicenie_minecraft Wpf/AssemblyInfo.cs | 10 + .../Cvicenie_minecraft Wpf.csproj | 12 + Cvicenie_minecraft Wpf/EArmorPartName.cs | 15 ++ Cvicenie_minecraft Wpf/EArmorType.cs | 16 ++ Cvicenie_minecraft Wpf/MainWindow.xaml | 77 +++++++ Cvicenie_minecraft Wpf/MainWindow.xaml.cs | 206 ++++++++++++++++++ Cvicenie_minecraft Wpf/armorpart.cs | 42 ++++ ...-ccb9b1ec-1d6e-4ffe-9552-9397c34a99c1 .png | Bin 0 -> 16462 bytes Cvicenie_pokemon/App.xaml | 9 + Cvicenie_pokemon/App.xaml.cs | 14 ++ Cvicenie_pokemon/AssemblyInfo.cs | 10 + Cvicenie_pokemon/Cvicenie_pokemon.csproj | 25 +++ Cvicenie_pokemon/Hero.cs | 24 ++ Cvicenie_pokemon/MainWindow.xaml | 10 + Cvicenie_pokemon/MainWindow.xaml.cs | 35 +++ Cvicenie_pokemon/Priserkabojimbojim.cs | 23 ++ Cvicenie_pokemon/Window_fight.xaml | 65 ++++++ Cvicenie_pokemon/Window_fight.xaml.cs | 94 ++++++++ Cvicenie_pokemon/obrazky/Charizard.png | Bin 0 -> 144568 bytes Cvicenie_pokemon/obrazky/Pikachu.png | Bin 0 -> 97508 bytes Rpg hra/Game.cs | 11 +- Rpg hra/Hero.cs | 2 +- Rpg hra/Monster.cs | 2 +- Rpg hra/Rpg hra.sln | 22 ++ Semafor/App.xaml | 9 + Semafor/App.xaml.cs | 14 ++ Semafor/AssemblyInfo.cs | 10 + Semafor/MainWindow.xaml | 46 ++++ Semafor/MainWindow.xaml.cs | 81 +++++++ Semafor/Semafor.csproj | 11 + WpfAppGuess/App.xaml | 9 + WpfAppGuess/App.xaml.cs | 14 ++ WpfAppGuess/AssemblyInfo.cs | 10 + WpfAppGuess/MainWindow.xaml | 83 +++++++ WpfAppGuess/MainWindow.xaml.cs | 91 ++++++++ WpfAppGuess/WpfAppGuess.csproj | 11 + WpfAppStopky/App.xaml | 9 + WpfAppStopky/App.xaml.cs | 14 ++ WpfAppStopky/AssemblyInfo.cs | 10 + WpfAppStopky/MainWindow.xaml | 60 +++++ WpfAppStopky/MainWindow.xaml.cs | 78 +++++++ WpfAppStopky/WpfAppStopky.csproj | 11 + cvicenie_first WPF/App.xaml | 9 + cvicenie_first WPF/App.xaml.cs | 14 ++ cvicenie_first WPF/AssemblyInfo.cs | 10 + cvicenie_first WPF/MainWindow.xaml | 66 ++++++ cvicenie_first WPF/MainWindow.xaml.cs | 39 ++++ cvicenie_first WPF/cvicenie_first WPF.csproj | 12 + 51 files changed, 1511 insertions(+), 5 deletions(-) create mode 100644 Cvicenie_minecraft Wpf/App.xaml create mode 100644 Cvicenie_minecraft Wpf/App.xaml.cs create mode 100644 Cvicenie_minecraft Wpf/AssemblyInfo.cs create mode 100644 Cvicenie_minecraft Wpf/Cvicenie_minecraft Wpf.csproj create mode 100644 Cvicenie_minecraft Wpf/EArmorPartName.cs create mode 100644 Cvicenie_minecraft Wpf/EArmorType.cs create mode 100644 Cvicenie_minecraft Wpf/MainWindow.xaml create mode 100644 Cvicenie_minecraft Wpf/MainWindow.xaml.cs create mode 100644 Cvicenie_minecraft Wpf/armorpart.cs create mode 100644 Cvicenie_minecraft Wpf/obrazky/d8ebr67-ccb9b1ec-1d6e-4ffe-9552-9397c34a99c1 .png create mode 100644 Cvicenie_pokemon/App.xaml create mode 100644 Cvicenie_pokemon/App.xaml.cs create mode 100644 Cvicenie_pokemon/AssemblyInfo.cs create mode 100644 Cvicenie_pokemon/Cvicenie_pokemon.csproj create mode 100644 Cvicenie_pokemon/Hero.cs create mode 100644 Cvicenie_pokemon/MainWindow.xaml create mode 100644 Cvicenie_pokemon/MainWindow.xaml.cs create mode 100644 Cvicenie_pokemon/Priserkabojimbojim.cs create mode 100644 Cvicenie_pokemon/Window_fight.xaml create mode 100644 Cvicenie_pokemon/Window_fight.xaml.cs create mode 100644 Cvicenie_pokemon/obrazky/Charizard.png create mode 100644 Cvicenie_pokemon/obrazky/Pikachu.png create mode 100644 Rpg hra/Rpg hra.sln create mode 100644 Semafor/App.xaml create mode 100644 Semafor/App.xaml.cs create mode 100644 Semafor/AssemblyInfo.cs create mode 100644 Semafor/MainWindow.xaml create mode 100644 Semafor/MainWindow.xaml.cs create mode 100644 Semafor/Semafor.csproj create mode 100644 WpfAppGuess/App.xaml create mode 100644 WpfAppGuess/App.xaml.cs create mode 100644 WpfAppGuess/AssemblyInfo.cs create mode 100644 WpfAppGuess/MainWindow.xaml create mode 100644 WpfAppGuess/MainWindow.xaml.cs create mode 100644 WpfAppGuess/WpfAppGuess.csproj create mode 100644 WpfAppStopky/App.xaml create mode 100644 WpfAppStopky/App.xaml.cs create mode 100644 WpfAppStopky/AssemblyInfo.cs create mode 100644 WpfAppStopky/MainWindow.xaml create mode 100644 WpfAppStopky/MainWindow.xaml.cs create mode 100644 WpfAppStopky/WpfAppStopky.csproj create mode 100644 cvicenie_first WPF/App.xaml create mode 100644 cvicenie_first WPF/App.xaml.cs create mode 100644 cvicenie_first WPF/AssemblyInfo.cs create mode 100644 cvicenie_first WPF/MainWindow.xaml create mode 100644 cvicenie_first WPF/MainWindow.xaml.cs create mode 100644 cvicenie_first WPF/cvicenie_first WPF.csproj diff --git a/AppsLab.CSharp.Exercises.sln b/AppsLab.CSharp.Exercises.sln index 13257776..6093b434 100644 --- a/AppsLab.CSharp.Exercises.sln +++ b/AppsLab.CSharp.Exercises.sln @@ -105,6 +105,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bettlesimulator", "Bettlesi EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cvicenie_idlefarmer", "Cvicenie_idlefarmer\Cvicenie_idlefarmer.csproj", "{E6AFBC85-C0F4-4A80-BC34-03982E3D658C}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cvicenie_pravdepodobnosť", "Cvicenie_pravdepodobnosť\Cvicenie_pravdepodobnosť.csproj", "{B6B66F97-A22F-4A00-A770-4FF4136D8F8D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cvicenie_gameshop", "cvicenie_gameshop\cvicenie_gameshop.csproj", "{F440743E-383A-45A7-93FC-CC0D81666B47}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cvicenie_sims", "Cvicenie_sims\Cvicenie_sims.csproj", "{9813755E-3759-4D95-9794-F213C4535129}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -703,6 +709,42 @@ Global {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Release|x64.Build.0 = Release|Any CPU {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Release|x86.ActiveCfg = Release|Any CPU {E6AFBC85-C0F4-4A80-BC34-03982E3D658C}.Release|x86.Build.0 = Release|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Debug|x64.ActiveCfg = Debug|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Debug|x64.Build.0 = Debug|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Debug|x86.ActiveCfg = Debug|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Debug|x86.Build.0 = Debug|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Release|Any CPU.Build.0 = Release|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Release|x64.ActiveCfg = Release|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Release|x64.Build.0 = Release|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Release|x86.ActiveCfg = Release|Any CPU + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D}.Release|x86.Build.0 = Release|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Debug|x64.ActiveCfg = Debug|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Debug|x64.Build.0 = Debug|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Debug|x86.ActiveCfg = Debug|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Debug|x86.Build.0 = Debug|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Release|Any CPU.Build.0 = Release|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Release|x64.ActiveCfg = Release|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Release|x64.Build.0 = Release|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Release|x86.ActiveCfg = Release|Any CPU + {F440743E-383A-45A7-93FC-CC0D81666B47}.Release|x86.Build.0 = Release|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Debug|x64.ActiveCfg = Debug|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Debug|x64.Build.0 = Debug|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Debug|x86.ActiveCfg = Debug|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Debug|x86.Build.0 = Debug|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Release|Any CPU.Build.0 = Release|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Release|x64.ActiveCfg = Release|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Release|x64.Build.0 = Release|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Release|x86.ActiveCfg = Release|Any CPU + {9813755E-3759-4D95-9794-F213C4535129}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -757,5 +799,11 @@ Global {66026C75-AC39-4F61-B53C-AE11FFCB3DB1} = {56555FB0-B513-49EF-9002-A5AF135EA090} {D6206AD6-9E73-4BC0-B737-485F31648DDA} = {56555FB0-B513-49EF-9002-A5AF135EA090} {E6AFBC85-C0F4-4A80-BC34-03982E3D658C} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {B6B66F97-A22F-4A00-A770-4FF4136D8F8D} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {F440743E-383A-45A7-93FC-CC0D81666B47} = {56555FB0-B513-49EF-9002-A5AF135EA090} + {9813755E-3759-4D95-9794-F213C4535129} = {56555FB0-B513-49EF-9002-A5AF135EA090} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4F4D9113-B761-4ACA-A622-94EE662BFFA9} EndGlobalSection EndGlobal diff --git a/Cvicenie_minecraft Wpf/App.xaml b/Cvicenie_minecraft Wpf/App.xaml new file mode 100644 index 00000000..04dc4dfa --- /dev/null +++ b/Cvicenie_minecraft Wpf/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/Cvicenie_minecraft Wpf/App.xaml.cs b/Cvicenie_minecraft Wpf/App.xaml.cs new file mode 100644 index 00000000..cd847b54 --- /dev/null +++ b/Cvicenie_minecraft Wpf/App.xaml.cs @@ -0,0 +1,14 @@ +using System.Configuration; +using System.Data; +using System.Windows; + +namespace Cvicenie_minecraft_Wpf +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } + +} diff --git a/Cvicenie_minecraft Wpf/AssemblyInfo.cs b/Cvicenie_minecraft Wpf/AssemblyInfo.cs new file mode 100644 index 00000000..b0ec8275 --- /dev/null +++ b/Cvicenie_minecraft Wpf/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Cvicenie_minecraft Wpf/Cvicenie_minecraft Wpf.csproj b/Cvicenie_minecraft Wpf/Cvicenie_minecraft Wpf.csproj new file mode 100644 index 00000000..2f4044d1 --- /dev/null +++ b/Cvicenie_minecraft Wpf/Cvicenie_minecraft Wpf.csproj @@ -0,0 +1,12 @@ + + + + WinExe + net8.0-windows + Cvicenie_minecraft_Wpf + enable + enable + true + + + diff --git a/Cvicenie_minecraft Wpf/EArmorPartName.cs b/Cvicenie_minecraft Wpf/EArmorPartName.cs new file mode 100644 index 00000000..6a2edbc6 --- /dev/null +++ b/Cvicenie_minecraft Wpf/EArmorPartName.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Cvicenie_minecraft_Wpf +{ + public enum EArmorPartName + { + Helmet,Chestplate,nohavice,Leg + + + } +} diff --git a/Cvicenie_minecraft Wpf/EArmorType.cs b/Cvicenie_minecraft Wpf/EArmorType.cs new file mode 100644 index 00000000..06c38f27 --- /dev/null +++ b/Cvicenie_minecraft Wpf/EArmorType.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Cvicenie_minecraft_Wpf +{ + public enum EArmorType + { + none,lether,chain,iron,gold,diamond + + + + } +} diff --git a/Cvicenie_minecraft Wpf/MainWindow.xaml b/Cvicenie_minecraft Wpf/MainWindow.xaml new file mode 100644 index 00000000..5a503068 --- /dev/null +++ b/Cvicenie_minecraft Wpf/MainWindow.xaml @@ -0,0 +1,77 @@ + + + + + diff --git a/Cvicenie_minecraft Wpf/MainWindow.xaml.cs b/Cvicenie_minecraft Wpf/MainWindow.xaml.cs new file mode 100644 index 00000000..ab1bc9b2 --- /dev/null +++ b/Cvicenie_minecraft Wpf/MainWindow.xaml.cs @@ -0,0 +1,206 @@ +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Cvicenie_minecraft_Wpf +{ + + public partial class MainWindow : Window + { + public string ImagePath { get; set; } = "C:\\Users\\Moskalm25\\Source\\Repos\\csharp\\Cvicenie_minecraft Wpf\\obrazky\\d8ebr67-ccb9b1ec-1d6e-4ffe-9552-9397c34a99c1 .png"; + + List Armors_Helm = new List(); + List ArmorParts_Body = new List(); + List ArmorParts_Pant = new List(); + List ArmorParts_Leg = new List(); + public armorpart Head { get; set; } + public armorpart Body { get; set; } + public armorpart Pant { get; set; } + public armorpart Leg { get; set; } + private void UpdateLabels() + { + var playerSet = new List(); + + if (Head != null) + playerSet.Add(Head); + if (Body != null) + playerSet.Add(Body); + if (Pant != null) + playerSet.Add(Pant); + if (Leg != null) + playerSet.Add(Leg); + + int totalArmor = playerSet.Sum(x => x.Armorpower); + + Label_ActualArmor.Content = totalArmor; + //PRepocitavanie a zapousivabnie do lablu + var groupedItems = playerSet.GroupBy(p => p.ArmorType, (key, g) => new { ArmorType = key, Items = g.ToList() }).ToList(); + var multiplaierValue = groupedItems.OrderByDescending(x => x.Items.Count).First().Items.Count; + Label_ArmorMultiplier.Content = multiplaierValue; + + var numberOfArmor = playerSet.Sum(x => x.Armorpower); + Label_ArmorPowerValue.Content = $"{numberOfArmor} (+{multiplaierValue * numberOfArmor})"; + } + public MainWindow() + { + InitializeComponent(); + + Armors_Helm.Add(new armorpart("Plesinka", 0, EArmorType.none, EArmorPartName.Helmet, 28, 29, 100, 90)); + Armors_Helm.Add(new armorpart("Helma bronzova", 1, EArmorType.lether, EArmorPartName.Helmet, 28, 29, 100, 90)); + Armors_Helm.Add(new armorpart("Helma retiazkova", 2, EArmorType.chain, EArmorPartName.Helmet, 177, 29, 100, 90)); + Armors_Helm.Add(new armorpart("Helma zelezna", 5, EArmorType.iron, EArmorPartName.Helmet, 338, 29, 100, 90)); + Armors_Helm.Add(new armorpart("Helma zlata", 10, EArmorType.gold, EArmorPartName.Helmet, 505, 29, 100, 90)); + Armors_Helm.Add(new armorpart("Helma diamantova", 20, EArmorType.diamond, EArmorPartName.Helmet, 659, 29, 100, 90)); + + combox_Helmpicker.ItemsSource = Armors_Helm; + + ArmorParts_Body.Add(new armorpart("Hola hrud", 0, EArmorType.none, EArmorPartName.Chestplate , 0, 0, 0, 0)); + ArmorParts_Body.Add(new armorpart("Body bronzove", 5, EArmorType.lether , EArmorPartName.Chestplate, 7, 136, 139, 130)); + ArmorParts_Body.Add(new armorpart("Body retiazkove", 10, EArmorType.chain, EArmorPartName.Chestplate, 159, 136, 139, 130)); + ArmorParts_Body.Add(new armorpart("Body zelezne", 15, EArmorType.iron, EArmorPartName.Chestplate, 321, 136, 139, 130)); + ArmorParts_Body.Add(new armorpart("Body zlate", 30, EArmorType.gold, EArmorPartName.Chestplate, 486, 136, 139, 130)); + ArmorParts_Body.Add(new armorpart("Body diamantove", 50, EArmorType.diamond, EArmorPartName.Chestplate, 639, 136, 139, 130)); + ComboBox_BodyPicker.ItemsSource = ArmorParts_Body; + + ArmorParts_Pant.Add(new armorpart("Trenky", 0, EArmorType.none, EArmorPartName.nohavice, 0, 0, 0, 0)); + ArmorParts_Pant.Add(new armorpart("Nohavice bronzove", 2, EArmorType.lether, EArmorPartName.nohavice, 26, 279, 100, 131)); + ArmorParts_Pant.Add(new armorpart("Nohavice retiazkove", 4, EArmorType.chain, EArmorPartName.nohavice, 179, 279, 100, 131)); + ArmorParts_Pant.Add(new armorpart("Nohavice zelezne", 8, EArmorType.iron, EArmorPartName.nohavice, 339, 279, 100, 131)); + ArmorParts_Pant.Add(new armorpart("Nohavice zlate", 15, EArmorType.gold, EArmorPartName.nohavice, 506, 279, 100, 131)); + ArmorParts_Pant.Add(new armorpart("Nohavice diamantove", 22, EArmorType.diamond, EArmorPartName.nohavice, 657, 279, 100, 131)); + ComboBox_PantPicker.ItemsSource = ArmorParts_Pant; + + ArmorParts_Leg.Add(new armorpart("Sandale", 0, EArmorType.none, EArmorPartName.Leg, 0, 0, 0, 0)); + ArmorParts_Leg.Add(new armorpart("Topanky bronzove", 2, EArmorType.lether, EArmorPartName.Leg, 2, 425, 140, 100)); + ArmorParts_Leg.Add(new armorpart("Topanky retiazkove", 4, EArmorType.chain, EArmorPartName.Leg, 159, 425, 140, 100)); + ArmorParts_Leg.Add(new armorpart("Topanky zelezne", 8, EArmorType.iron, EArmorPartName.Leg, 319, 425, 140, 100)); + ArmorParts_Leg.Add(new armorpart("Topanky zlate", 15, EArmorType.gold, EArmorPartName.Leg, 484, 425, 140, 100)); + ArmorParts_Leg.Add(new armorpart("Topanky diamantove", 22, EArmorType.diamond, EArmorPartName.Leg, 636, 425, 140, 100)); + ComboBox_LegPicker.ItemsSource = ArmorParts_Leg; + } + + private void combox_Helmpicker_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + armorpart armorPart=(armorpart)combox_Helmpicker.SelectedItem as armorpart; + Head = armorPart; + if (armorPart.ArmorType != EArmorType.none) + { + var bitmap = new BitmapImage(); + bitmap.BeginInit(); + bitmap.UriSource = new Uri(ImagePath, UriKind.Absolute); + bitmap.CacheOption = BitmapCacheOption.OnLoad; // aby sa súbor neu lockol + bitmap.EndInit(); + bitmap.Freeze(); + + var cropped = new CroppedBitmap(bitmap, new Int32Rect(armorPart.XLeft, armorPart.YTop, armorPart.Width, armorPart.Height)); + cropped.Freeze(); + + Image_HelmetPlaceHolder.Source = cropped; + Image_HelmetPlaceHolder.Visibility = Visibility.Visible; + + } + + else + { + + Image_HelmetPlaceHolder.Visibility= Visibility.Collapsed; + } + + UpdateLabels(); + } + + private void ComboBox_BodyPicker_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + armorpart armorPart = (armorpart)ComboBox_BodyPicker.SelectedItem as armorpart; + Body = armorPart; + if (armorPart.ArmorType != EArmorType.none) + { + var bitmap = new BitmapImage(); + bitmap.BeginInit(); + bitmap.UriSource = new Uri(ImagePath, UriKind.Absolute); + bitmap.CacheOption = BitmapCacheOption.OnLoad; // aby sa súbor neu lockol + bitmap.EndInit(); + bitmap.Freeze(); + + var cropped = new CroppedBitmap(bitmap, new Int32Rect(armorPart.XLeft, armorPart.YTop, armorPart.Width, armorPart.Height)); + cropped.Freeze(); + + Image_chestPlaceHolder.Source = cropped; + Image_chestPlaceHolder.Visibility = Visibility.Visible; + } + + else + { + + Image_chestPlaceHolder.Visibility = Visibility.Collapsed; + } + + UpdateLabels(); + } + + private void ComboBox_PantPicker_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + armorpart armorPart = (armorpart)ComboBox_PantPicker.SelectedItem as armorpart; + Pant = armorPart; + if (armorPart.ArmorType != EArmorType.none) + { + var bitmap = new BitmapImage(); + bitmap.BeginInit(); + bitmap.UriSource = new Uri(ImagePath, UriKind.Absolute); + bitmap.CacheOption = BitmapCacheOption.OnLoad; // aby sa súbor neu lockol + bitmap.EndInit(); + bitmap.Freeze(); + + var cropped = new CroppedBitmap(bitmap, new Int32Rect(armorPart.XLeft, armorPart.YTop, armorPart.Width, armorPart.Height)); + cropped.Freeze(); + + Image_nohavicePlaceHolder.Source = cropped; + Image_nohavicePlaceHolder.Visibility = Visibility.Visible; + } + + else + { + + Image_nohavicePlaceHolder.Visibility = Visibility.Collapsed; + } + UpdateLabels(); + + } + + private void ComboBox_LegPicker_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + armorpart armorPart = (armorpart)ComboBox_LegPicker.SelectedItem as armorpart; + Leg = armorPart; + if (armorPart.ArmorType != EArmorType.none) + { + var bitmap = new BitmapImage(); + bitmap.BeginInit(); + bitmap.UriSource = new Uri(ImagePath, UriKind.Absolute); + bitmap.CacheOption = BitmapCacheOption.OnLoad; // aby sa súbor neu lockol + bitmap.EndInit(); + bitmap.Freeze(); + + var cropped = new CroppedBitmap(bitmap, new Int32Rect(armorPart.XLeft, armorPart.YTop, armorPart.Width, armorPart.Height)); + cropped.Freeze(); + + Image_legPlaceHolder.Source = cropped; + Image_legPlaceHolder.Visibility = Visibility.Visible; + } + + else + { + + Image_legPlaceHolder.Visibility = Visibility.Collapsed; + } + UpdateLabels(); + + } + } +} \ No newline at end of file diff --git a/Cvicenie_minecraft Wpf/armorpart.cs b/Cvicenie_minecraft Wpf/armorpart.cs new file mode 100644 index 00000000..5944cc57 --- /dev/null +++ b/Cvicenie_minecraft Wpf/armorpart.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Controls; +using System.Xml.Linq; + +namespace Cvicenie_minecraft_Wpf +{ + public class armorpart + { + + public string DisplayName { get; set; } + public int Armorpower { get; set; } + + public EArmorType ArmorType { get; set; } + public EArmorPartName PartName { get; set; } + public int XLeft { get; set; } + public int YTop { get; set; } + public int Width { get; set; } + public int Height { get; set; } + + public armorpart(string displayName, int armorpower, EArmorType armorType, EArmorPartName partName, int xLeft, int yTop, int width, int height) + { + DisplayName = displayName; + Armorpower = armorpower; + ArmorType = armorType; + PartName = partName; + XLeft = xLeft; + YTop = yTop; + Width = width; + Height = height; + } + + public override string ToString() + { + return DisplayName; // or whatever property you want to show + } + + } +} diff --git a/Cvicenie_minecraft Wpf/obrazky/d8ebr67-ccb9b1ec-1d6e-4ffe-9552-9397c34a99c1 .png b/Cvicenie_minecraft Wpf/obrazky/d8ebr67-ccb9b1ec-1d6e-4ffe-9552-9397c34a99c1 .png new file mode 100644 index 0000000000000000000000000000000000000000..4bd7028b51a24e7ecb1854817d84e918f95cbed4 GIT binary patch literal 16462 zcmZ|0Q?O{Ux;40L+qP{Rd)c;aYcJcjZQHhO+g9&$?(M(3ANs4x%&75=j8yWFnwgnV zloS&a6952E6BUwImFG~00ssJj_*ZCv0hoXQ{xJlm`~U!R)qvT6RJ6d%KzuH2sp2Gs zq=aM*lY4n^;U>0k#G^k~9QNM8W^dJdOjt61XO4cSe}leD@AYE52j6mU`5Sxpe=U52 zs_FOmTYmDs(myBq{c;~(&yZh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TW@M7L1PW7ZrmMafl_U`7<4o5eidM$8HjXt<&%?X)}6nyra2m776R#Mr$`-hyXb7~5*K*p6)^)kioNQYc8&vF?%j$nbt3kLdC^mSmE#{35|ML9vH) zMO=z~Slh*G66nM)f;?7w=}CL}_2WY2h z$Tw3Xv#;{d(a|4m8LUBiWe{B+fpQ&x*5oaR_;f)qQNgHAU(rRER9JFHNR*7^O9&&2 zW=2Ue4R#h(0VqxR<10v8=aCVPuKmrB1w<&KL61kqUp1Ws9qc^4lT%W_Pt*fCEoo;? zei4FY{z7xOvwv{|fc;enPXbWa;Z4|7tn${J{`aN?=z_BOf6Q5+tLeMBtLNCnduE7Ra!XJ z($JKz%Zb{WrNDu3;LX3-5~SASwUIxJ`5+@XAUSk^`?1eSs*tx@L0l}43YJM;%E+b` z0>?X)O4$)*^ZLqPi6K}`ThINq+h`lhu*{%vXrk)PCP{Wx#wDxQ;mwxMc>0l4Zs{C? zXVdRKF7R@KR0`7eEKe{Qrvg9qm=Dz + + + + diff --git a/Cvicenie_pokemon/App.xaml.cs b/Cvicenie_pokemon/App.xaml.cs new file mode 100644 index 00000000..0e9f5a9d --- /dev/null +++ b/Cvicenie_pokemon/App.xaml.cs @@ -0,0 +1,14 @@ +using System.Configuration; +using System.Data; +using System.Windows; + +namespace Cvicenie_pokemon +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } + +} diff --git a/Cvicenie_pokemon/AssemblyInfo.cs b/Cvicenie_pokemon/AssemblyInfo.cs new file mode 100644 index 00000000..b0ec8275 --- /dev/null +++ b/Cvicenie_pokemon/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Cvicenie_pokemon/Cvicenie_pokemon.csproj b/Cvicenie_pokemon/Cvicenie_pokemon.csproj new file mode 100644 index 00000000..a4beecbc --- /dev/null +++ b/Cvicenie_pokemon/Cvicenie_pokemon.csproj @@ -0,0 +1,25 @@ + + + + WinExe + net8.0-windows + enable + enable + true + + + + + + + + + + Always + + + Always + + + + diff --git a/Cvicenie_pokemon/Hero.cs b/Cvicenie_pokemon/Hero.cs new file mode 100644 index 00000000..45c765b8 --- /dev/null +++ b/Cvicenie_pokemon/Hero.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Cvicenie_pokemon +{ + public class Hero + { + + + public int Helth { get; set; } + public int MaximumHelth { get; set; } + public int Demage { get; set; } + + public Hero(int helth, int maximumHelth, int demage) + { + Helth = helth; + MaximumHelth = maximumHelth; + Demage = demage; + } + } +} diff --git a/Cvicenie_pokemon/MainWindow.xaml b/Cvicenie_pokemon/MainWindow.xaml new file mode 100644 index 00000000..d6ceafdf --- /dev/null +++ b/Cvicenie_pokemon/MainWindow.xaml @@ -0,0 +1,10 @@ + + + diff --git a/Cvicenie_pokemon/MainWindow.xaml.cs b/Cvicenie_pokemon/MainWindow.xaml.cs new file mode 100644 index 00000000..7b7d8f96 --- /dev/null +++ b/Cvicenie_pokemon/MainWindow.xaml.cs @@ -0,0 +1,35 @@ +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Cvicenie_pokemon +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + Hero myhero=new Hero(50,100,10); + Priserkabojimbojim myenemy = new Priserkabojimbojim(100, 200, 1 ); + + + Window_fight fight_window = new Window_fight( myhero, myenemy); + fight_window.Show(); + } + + + + + + } +} \ No newline at end of file diff --git a/Cvicenie_pokemon/Priserkabojimbojim.cs b/Cvicenie_pokemon/Priserkabojimbojim.cs new file mode 100644 index 00000000..56bd8f02 --- /dev/null +++ b/Cvicenie_pokemon/Priserkabojimbojim.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Cvicenie_pokemon +{ + public class Priserkabojimbojim + { + + public int Helth { get; set; } + public int MaximumHelth { get; set; } + public int Demage { get; set; } + + public Priserkabojimbojim(int helth , int maximumHelth, int demage ) + { + Helth = helth; + MaximumHelth = maximumHelth; + Demage = demage; + } + } +} diff --git a/Cvicenie_pokemon/Window_fight.xaml b/Cvicenie_pokemon/Window_fight.xaml new file mode 100644 index 00000000..14700c6f --- /dev/null +++ b/Cvicenie_pokemon/Window_fight.xaml @@ -0,0 +1,65 @@ + + + + + +