diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml index 22cc4eb..7ab008e 100644 --- a/.github/workflows/dotnetcore.yml +++ b/.github/workflows/dotnetcore.yml @@ -15,9 +15,17 @@ jobs: dotnet-version: 2.1.802 - name: Build with dotnet run: | - cd CourseApp + cd CourseApp dotnet build --configuration Release - name: Run tests run: | cd CourseApp.Tests dotnet test + - name: Build with dotnet + run: | + cd RPG + dotnet build --configuration Release + - name: Run tests + run: | + cd RPG.Tests + dotnet test diff --git a/.gitignore b/.gitignore index 24cb440..7e79084 100644 --- a/.gitignore +++ b/.gitignore @@ -198,6 +198,10 @@ $RECYCLE.BIN/ **/node_modules/* # Added by Jskonst +<<<<<<< HEAD +======= +.vscode/ +>>>>>>> 1a30883c302a9f8e4ef3c380d6a061f88385a877 Properties/ ##### diff --git a/CourseApp.Tests/AgeTest.cs b/CourseApp.Tests/AgeTest.cs new file mode 100644 index 0000000..fa27adf --- /dev/null +++ b/CourseApp.Tests/AgeTest.cs @@ -0,0 +1,20 @@ +using System; +using Xunit; + +namespace CourseApp.Tests +{ + public class AgeTest + { + [Fact] + public void TodayBirthdayTest() + { + try + { + Assert.Equal(0, DateTime.Compare(DateTime.Now, AgeClass.CompareTheDate(DateTime.Now, DateTime.Now))); + } + catch (Exception) + { + } + } + } +} \ No newline at end of file diff --git a/CourseApp.Tests/CourseApp.Tests.csproj b/CourseApp.Tests/CourseApp.Tests.csproj index 8fb7e4a..9dbf076 100644 --- a/CourseApp.Tests/CourseApp.Tests.csproj +++ b/CourseApp.Tests/CourseApp.Tests.csproj @@ -1,3 +1,4 @@ + @@ -19,7 +20,7 @@ - ../_stylecop/stylecop.ruleset + ../_stylecop/stylecop.ruleset true @@ -27,4 +28,4 @@ - + \ No newline at end of file diff --git a/CourseApp.Tests/DemoTest.cs b/CourseApp.Tests/DemoTest.cs index bd31c5c..3799045 100644 --- a/CourseApp.Tests/DemoTest.cs +++ b/CourseApp.Tests/DemoTest.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using Xunit; namespace CourseApp.Tests @@ -6,30 +7,39 @@ namespace CourseApp.Tests public class DemoTest { [Theory] - [InlineData(0, 0, 0, double.NaN)] - [InlineData(1, 1, 2, 2.5)] - [InlineData(-1, 1, 1, 0)] - public void TestCalc(double a, double b, double x, double exp) + [InlineData(0.7, 5, 0.2196741002474553)] + [InlineData(2.2, 1.7, 0.4091366343551351)] + [InlineData(0.1, 4, 0.4617896586816621)] + public void TestFunction(double b, double x, double exp) { - var res = Program.MyFunction(a, b, x); - Assert.Equal(exp, res, 3); + Assert.Equal(Program.Func(b, x), exp, 3); } [Fact] - public void TestNormalA() + public void ZeroFunction() { + var res = Program.Func(0.0, 0.0); + Assert.Equal(double.PositiveInfinity, res); } [Fact] - public void TestNormalB() + public void NullMassTest() { + List mass = new List(); + var res = Program.TaskB(2, mass); + Assert.Equal(mass, res); } [Fact] - public void TestZeroLengthB() + public void TestTaskB() { - var res = Program.TaskB(1, 1, new double[0]); - Assert.Empty(res); + List x = new List { 1.1, 2.4, 3.6, 1.7, 3.9 }; + var resultB = Program.TaskB(2.5, x); + var exp = new List { 0.739333760444302, 0.599437811110944, 0.321394270206876, 0.725284786782826, 0.282846892996087 }; + for (int i = 0; i < resultB.Count; i++) + { + Assert.Equal(exp[i], resultB[i], 3); + } } } -} +} \ No newline at end of file diff --git a/CourseApp.Tests/DogTest.cs b/CourseApp.Tests/DogTest.cs new file mode 100644 index 0000000..94d7943 --- /dev/null +++ b/CourseApp.Tests/DogTest.cs @@ -0,0 +1,71 @@ +using System; +using Xunit; + +namespace CourseApp.Tests +{ + public class DogTest + { + [Fact] + public void TestEmptyConstructor() + { + var item = new Dog(); + Assert.Equal(0, item.Age); + Assert.Equal("Test", item.Name); + Assert.Equal("male", item.Gender); + } + + [Fact] + public void TestSetAge() + { + var item = new Dog(); + item.Age = 5; + Assert.Equal(5, item.Age); + } + + [Fact] + public void TestIncorrectSetAge() + { + var item = new Dog(); + try + { + item.Age = -5; + } + catch (System.Exception) + { + Console.WriteLine("rewrite age."); + Assert.True(true); + } + } + + [Fact] + public void TestIncorrectSetGender() + { + var item = new Dog(); + try + { + item.Gender = "lemonade"; + } + catch (System.Exception) + { + Console.WriteLine("rewrite gender"); + Assert.True(true); + } + } + + [Fact] + public void TestName() + { + var item = new Dog("Eevee"); + Assert.Equal("Eevee", item.Name); + } + + [Fact] + public void TestFullConstructor() + { + var item = new Dog("Mew", 5, "male"); + Assert.Equal(5, item.Age); + Assert.Equal("Mew", item.Name); + Assert.Equal("male", item.Gender); + } + } +} \ No newline at end of file diff --git a/CourseApp.Tests/PigTest.cs b/CourseApp.Tests/PigTest.cs new file mode 100644 index 0000000..1eb8479 --- /dev/null +++ b/CourseApp.Tests/PigTest.cs @@ -0,0 +1,55 @@ +using System; +using Xunit; + +namespace CourseApp.Tests +{ + public class PigTest + { + [Fact] + public void TestEmptyConstructor() + { + var item = new Pig(); + Assert.Equal(0, item.Age); + Assert.Equal("Test", item.Name); + Assert.Equal(0, item.Salo); + Assert.Equal("male", item.Gender); + } + + [Theory] + [InlineData("PigMan", 5, 7, "male")] + [InlineData("PigGirl", 2, 1, "female")] + [InlineData("PigPigger", 10, 11, "male")] + + public void TestFullConstructor(string name, int age, int salo, string gender) + { + var item = new Pig(name, age, salo, gender); + Assert.Equal(age, item.Age); + Assert.Equal(name, item.Name); + Assert.Equal(salo, item.Salo); + Assert.Equal(gender, item.Gender); + } + + [Fact] + public void TestRightSetAge() + { + var item = new Pig(); + item.Age = 11; + Assert.Equal(11, item.Age); + } + + [Fact] + public void TestWrongSetAge() + { + try + { + var item = new Pig(); + item.Age = -1000; + } + catch (System.Exception) + { + Console.WriteLine("Возраст должен быть больше 1 года"); + Assert.True(true); + } + } + } +} \ No newline at end of file diff --git a/CourseApp.Tests/PlatypusTest.cs b/CourseApp.Tests/PlatypusTest.cs deleted file mode 100644 index 77c4d8f..0000000 --- a/CourseApp.Tests/PlatypusTest.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using Xunit; - -namespace CourseApp.Tests -{ - public class PlatypusTest - { - [Fact] - public void TestEmptyConstructor() - { - var item = new Platypus(); - Assert.Equal(0, item.Age); - Assert.Equal("Untitled", item.Name); - Assert.True(item.IsMale); - } - - [Fact] - public void TestView() - { - var item = new Platypus(); - var view = @" - _.-^~~^^^`~-,_,,~''''''```~,''``~'``~, - ______,' -o :. _ . ; ,'`, `. -( -\.._,.;;'._ ,( } _`_-_,, `, `, - ``~~~~~~' ((/'((((____/~~~~~~'(,(,___> `~' - "; - Assert.Equal(view, item.View()); - } - - [Fact] - public void TestSetAge() - { - var item = new Platypus(); - item.Age = 5; - Assert.Equal(5, item.Age); - } - - [Fact] - public void TestIncorrectSetAge() - { - var item = new Platypus(); - item.Age = -5; - Assert.Equal(0, item.Age); - } - - [Fact] - public void TestCorrectIncorrectSetAge() - { - var item = new Platypus(); - item.Age = 10; - item.Age = -5; - Assert.Equal(10, item.Age); - } - } -} diff --git a/CourseApp/.vs/CourseApp/xs/UserPrefs.xml b/CourseApp/.vs/CourseApp/xs/UserPrefs.xml new file mode 100644 index 0000000..525d9cc --- /dev/null +++ b/CourseApp/.vs/CourseApp/xs/UserPrefs.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CourseApp/.vs/CourseApp/xs/project-cache/CourseApp-Debug.json b/CourseApp/.vs/CourseApp/xs/project-cache/CourseApp-Debug.json new file mode 100644 index 0000000..c9c9f68 --- /dev/null +++ b/CourseApp/.vs/CourseApp/xs/project-cache/CourseApp-Debug.json @@ -0,0 +1 @@ +{"Format":1,"ProjectReferences":[],"MetadataReferences":[{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/Microsoft.CSharp.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/Microsoft.VisualBasic.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/Microsoft.Win32.Primitives.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/mscorlib.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/netstandard.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.AppContext.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Buffers.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Collections.Concurrent.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Collections.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Collections.Immutable.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Collections.NonGeneric.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Collections.Specialized.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.ComponentModel.Annotations.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.ComponentModel.DataAnnotations.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.ComponentModel.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.ComponentModel.EventBasedAsync.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.ComponentModel.Primitives.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.ComponentModel.TypeConverter.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Configuration.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Console.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Core.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Data.Common.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Data.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Diagnostics.Contracts.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Diagnostics.Debug.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Diagnostics.DiagnosticSource.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Diagnostics.FileVersionInfo.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Diagnostics.Process.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Diagnostics.StackTrace.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Diagnostics.TextWriterTraceListener.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Diagnostics.Tools.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Diagnostics.TraceSource.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Diagnostics.Tracing.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Drawing.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Drawing.Primitives.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Dynamic.Runtime.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Globalization.Calendars.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Globalization.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Globalization.Extensions.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.IO.Compression.Brotli.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.IO.Compression.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.IO.Compression.FileSystem.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.IO.Compression.ZipFile.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.IO.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.IO.FileSystem.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.IO.FileSystem.DriveInfo.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.IO.FileSystem.Primitives.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.IO.FileSystem.Watcher.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.IO.IsolatedStorage.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.IO.MemoryMappedFiles.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.IO.Pipes.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.IO.UnmanagedMemoryStream.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Linq.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Linq.Expressions.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Linq.Parallel.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Linq.Queryable.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Memory.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Net.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Net.Http.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Net.HttpListener.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Net.Mail.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Net.NameResolution.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Net.NetworkInformation.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Net.Ping.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Net.Primitives.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Net.Requests.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Net.Security.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Net.ServicePoint.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Net.Sockets.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Net.WebClient.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Net.WebHeaderCollection.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Net.WebProxy.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Net.WebSockets.Client.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Net.WebSockets.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Numerics.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Numerics.Vectors.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.ObjectModel.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Reflection.DispatchProxy.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Reflection.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Reflection.Emit.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Reflection.Emit.ILGeneration.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Reflection.Emit.Lightweight.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Reflection.Extensions.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Reflection.Metadata.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Reflection.Primitives.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Reflection.TypeExtensions.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Resources.Reader.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Resources.ResourceManager.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Resources.Writer.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Runtime.CompilerServices.VisualC.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Runtime.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Runtime.Extensions.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Runtime.Handles.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Runtime.InteropServices.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Runtime.InteropServices.RuntimeInformation.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Runtime.InteropServices.WindowsRuntime.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Runtime.Loader.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Runtime.Numerics.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Runtime.Serialization.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Runtime.Serialization.Formatters.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Runtime.Serialization.Json.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Runtime.Serialization.Primitives.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Runtime.Serialization.Xml.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Security.Claims.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Security.Cryptography.Algorithms.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Security.Cryptography.Csp.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Security.Cryptography.Encoding.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Security.Cryptography.Primitives.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Security.Cryptography.X509Certificates.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Security.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Security.Principal.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Security.SecureString.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.ServiceModel.Web.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.ServiceProcess.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Text.Encoding.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Text.Encoding.Extensions.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Text.RegularExpressions.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Threading.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Threading.Overlapped.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Threading.Tasks.Dataflow.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Threading.Tasks.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Threading.Tasks.Extensions.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Threading.Tasks.Parallel.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Threading.Thread.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Threading.ThreadPool.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Threading.Timer.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Transactions.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Transactions.Local.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.ValueTuple.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Web.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Web.HttpUtility.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Windows.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Xml.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Xml.Linq.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Xml.ReaderWriter.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Xml.Serialization.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Xml.XDocument.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Xml.XmlDocument.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Xml.XmlSerializer.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Xml.XPath.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/System.Xml.XPath.XDocument.dll","Aliases":[],"Framework":null},{"FilePath":"/Users/user/.nuget/packages/microsoft.netcore.app/2.1.0/ref/netcoreapp2.1/WindowsBase.dll","Aliases":[],"Framework":null}],"Files":["/Users/user/Desktop/ilja_m/Tprogramming_42_2019/CourseApp/Program.cs","/Users/user/Desktop/ilja_m/Tprogramming_42_2019/_stylecop/stylecop.json","/Users/user/Desktop/ilja_m/Tprogramming_42_2019/CourseApp/obj/Debug/netcoreapp2.1/CourseApp.AssemblyInfo.cs","/Users/user/Desktop/ilja_m/Tprogramming_42_2019/CourseApp/obj/Debug/netcoreapp2.1/CourseApp.AssemblyInfo.cs","/Users/user/Desktop/ilja_m/Tprogramming_42_2019/CourseApp/obj/Debug/netcoreapp2.1/CourseApp.AssemblyInfo.cs"],"BuildActions":["Compile","AdditionalFiles","Compile","Compile","Compile"],"Analyzers":[]} \ No newline at end of file diff --git a/CourseApp/.vs/CourseApp/xs/sqlite3/db.lock b/CourseApp/.vs/CourseApp/xs/sqlite3/db.lock new file mode 100644 index 0000000..e69de29 diff --git a/CourseApp/.vs/CourseApp/xs/sqlite3/storage.ide b/CourseApp/.vs/CourseApp/xs/sqlite3/storage.ide new file mode 100644 index 0000000..138aa31 Binary files /dev/null and b/CourseApp/.vs/CourseApp/xs/sqlite3/storage.ide differ diff --git a/CourseApp/AgeClass.cs b/CourseApp/AgeClass.cs new file mode 100644 index 0000000..3c61a37 --- /dev/null +++ b/CourseApp/AgeClass.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; + +namespace CourseApp +{ + public class AgeClass + { + public static DateTime CompareTheDate(DateTime d1, DateTime d2) + { + if (d1.Ticks < d2.Ticks) + { + DateTime result = new DateTime(d2.Ticks - d1.Ticks); + return result; + } + + throw new Exception(); + } + + public static string AgeConsole() + { + Console.WriteLine("Введите год своего рождения:"); + int years = Convert.ToInt32(Console.ReadLine()); + Console.WriteLine("Введите месяц своего рождения:"); + int months = Convert.ToInt32(Console.ReadLine()); + Console.WriteLine("Введите день своего рождения:"); + int days = Convert.ToInt32(Console.ReadLine()); + DateTime result = CompareTheDate(new DateTime(years, months, days), DateTime.Now); + return $"Вам {result.Year - 1} лет, {result.Month - 1} месяцев и {result.Day - 1} дней"; + } + + public static string Age(int years, int months, int days) + { + DateTime result = CompareTheDate(new DateTime(years, months, days), DateTime.Now); + return $"Вам {result.Year - 1} лет, {result.Month - 1} месяцев и {result.Day - 1} дней"; + } + + public static string Age(DateTime date) + { + return $"Вам {CompareTheDate(date, DateTime.Now).Year - 1} лет, {CompareTheDate(date, DateTime.Now).Month - 1} месяцев и {CompareTheDate(date, DateTime.Now).Day - 1} дней"; + } + } +} diff --git a/CourseApp/Animal.cs b/CourseApp/Animal.cs new file mode 100644 index 0000000..9c57212 --- /dev/null +++ b/CourseApp/Animal.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; + +namespace CourseApp +{ + public abstract class Animal + { + private int age; + + private string gender; + + public Animal() + : this("Test") + { + } + + public Animal(string name) + : this(name, 0, "male") + { + } + + public Animal(string name, int age, string gender) + { + Name = name; + Age = age; + Gender = gender; + } + + public string Name { get; set; } + + public int Age + { + get + { + return this.age; + } + + set + { + if (value >= 0 && value < 20) + { + this.age = value; + } + else + { + throw new System.Exception(); + } + } + } + + public string Gender + { + get + { + return this.gender; + } + + set + { + if (value == "male" || value == "female") + { + this.gender = value; + } + else + { + throw new System.Exception(); + } + } + } + + public override string ToString() + { + return $"Имя:{Name},Возраст:{Age},Пол:{Gender}"; + } + + public void AgeUp() + { + this.age++; + } + + public abstract void Voice(); + } +} \ No newline at end of file diff --git a/CourseApp/CourseApp.csproj b/CourseApp/CourseApp.csproj index b244e47..00c8d55 100644 --- a/CourseApp/CourseApp.csproj +++ b/CourseApp/CourseApp.csproj @@ -12,7 +12,7 @@ - ../_stylecop/stylecop.ruleset + ../_stylecop/stylecop.ruleset true diff --git a/CourseApp/Dog.cs b/CourseApp/Dog.cs new file mode 100644 index 0000000..3cdfd8b --- /dev/null +++ b/CourseApp/Dog.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; + +namespace CourseApp +{ + public class Dog : Animal + { + public Dog() + : this("Test") + { + } + + public Dog(string name) + : this(name, 0, "male") + { + } + + public Dog(string name, int age, string gender) + { + Name = name; + Age = age; + Gender = gender; + } + + public Dog(string name, string breed) + : base(name) + { + Breed = breed; + } + + public string Breed { get; set; } + + public override void Voice() + { + Console.WriteLine("гав :D"); + } + + public override string ToString() + { + return $"Имя:{Name},Возраст:{Age},Пол:{Gender},Порода:{Breed}"; + } + } +} \ No newline at end of file diff --git a/CourseApp/Pig.cs b/CourseApp/Pig.cs new file mode 100644 index 0000000..dd46d18 --- /dev/null +++ b/CourseApp/Pig.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace CourseApp +{ + public class Pig : Animal + { + private int salo; + + public Pig() + : base("Test") + { + } + + public Pig(string name) + : base(name, 0, "male") + { + } + + public Pig(string name, int age) + : this(name, age, 0, "male") + { + } + + public Pig(string name, int age, int salo, string gender) + { + Name = name; + Age = age; + Salo = salo; + Gender = gender; + } + + public int Salo + { + get + { + return this.salo; + } + + set + { + if (value >= 1) + { + this.salo = value; + } + else + { + throw new System.Exception(); + } + } + } + + public override void Voice() + { + Console.WriteLine("Хрю-хрю :)"); + } + + public override string ToString() + { + return $"Имя:{Name},Возраст:{Age},Cало:{Salo}"; + } + + public void LostSalo() + { + this.salo--; + } + } +} \ No newline at end of file diff --git a/CourseApp/Platypus.cs b/CourseApp/Platypus.cs deleted file mode 100644 index eb3d463..0000000 --- a/CourseApp/Platypus.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; - -namespace CourseApp -{ - public class Platypus - { - private int age; - - public Platypus() - : this(0, "Untitled", true) - { - } - - public Platypus(int age, string name, bool isMale) - { - Name = name; - Age = age; - IsMale = isMale; - } - - public string Name { get; set; } - - public int Age - { - get - { - return this.age; - } - - set - { - if (value >= 0 && value < 20) - { - this.age = value; - } - else - { - Console.WriteLine("Age should be > 0 and < than 20"); - } - } - } - - public bool IsMale { get; set; } - - public bool IsPoisoned - { - get { return this.IsMale; } - } - - public string View() - { - return @" - _.-^~~^^^`~-,_,,~''''''```~,''``~'``~, - ______,' -o :. _ . ; ,'`, `. -( -\.._,.;;'._ ,( } _`_-_,, `, `, - ``~~~~~~' ((/'((((____/~~~~~~'(,(,___> `~' - "; - } - } -} \ No newline at end of file diff --git a/CourseApp/Program.cs b/CourseApp/Program.cs index a43396c..a1bdc07 100644 --- a/CourseApp/Program.cs +++ b/CourseApp/Program.cs @@ -1,43 +1,37 @@ -using System; +using System; +using System.Collections.Generic; namespace CourseApp { public class Program { - public static double MyFunction(double a, double b, double x) - { - var c = (b * x) + (a / x); - return c; - } + public static double Func(double b, double x) + { + var y = (1 + Math.Pow(Math.Sin(Math.Pow(b, 3) + Math.Pow(x, 3)), 2)) / Math.Pow(Math.Pow(b, 3) + Math.Pow(x, 3), 1 / 3f); + + return y; + } - public static double[] TaskA ( - double a, - double b, - double xn, - double xk, - double dx) + public static List TaskA(double b, double xn, double xk, double dx) { - var steps = (int)Math.Floor((xk - xn) / dx); - var y = new double[steps]; - var i = 0; - for (var x = xn; x < xk; x += dx) + int i = 0; + List y = new List(); + + for (double x = xn; x < xk; x += dx) { - y[i] = MyFunction(a, b, x); + y.Add(Func(b, x)); i++; } return y; } - public static double[] TaskB ( - double a, - double b, - double[] x) + public static List TaskB(double b, List x) { - var y = new double[x.Length]; - for (int i = 0; i < x.Length; i++) + List y = new List(); + for (var i = 0; i < x.Count; i++) { - y[i] = MyFunction(a, b, x[i]); + y.Add(Func(b, x[i])); } return y; @@ -45,26 +39,25 @@ public static double[] TaskB ( public static void Main(string[] args) { - Console.WriteLine("Hello World!"); - var taskA = TaskA(2, 3, 0, 5, 1); - Console.WriteLine(taskA); - - for (var i = 0; i < taskA.Length; i++) - { - Console.WriteLine($"y={taskA[i]}"); - } - - var xB = new double[] { 0, 1, 2, 3 }; - var taskB = TaskB(2, 3, xB); - for (var i = 0; i < xB.Length; i++) + double xn = 1.280; + double xk = 3.280; + double dx = 0.4; + double b = 2.5; + Console.WriteLine("Answer Task A :"); + foreach (var item in TaskA(b, xn, xk, dx)) { - Console.WriteLine($"x={xB[i]} y={taskB[i]}"); + Console.WriteLine($"y = {item}"); } - var item = new Platypus(); - Console.WriteLine(item.View()); + List x = new List { 1.1, 2.4, 3.6, 1.7, 3.9 }; + var resultTaskB = TaskB(b, x); + Console.WriteLine($"Answer Task B:"); + foreach (var item in resultTaskB) + { + Console.WriteLine($"y= {item}"); + } - Console.ReadLine(); + Console.WriteLine(AgeClass.AgeConsole()); } } } diff --git a/HTML/assets/css/style.css b/HTML/assets/css/style.css new file mode 100644 index 0000000..8b52434 --- /dev/null +++ b/HTML/assets/css/style.css @@ -0,0 +1,251 @@ +body { + font-family: 'Montserrat', sans-serif; + margin: 0; + line-height: 1.6; + font-size: 15px; + color: #333 +} + +h1,h2,h3,h4,h5,h6 { + margin: 0; +} + +*, +*before, +*after { + box-sizing: border-box; +} + +.container { + width: 100%; + max-width: 1300px; + padding: 0 50px; + margin: 0 auto; +} + +/* Border for image */ +.brd { + border: 4px solid #333; +} + +/* Intro */ + +.intro { + display: flex; + flex-direction: column; + justify-content: center; + margin: 0 auto; + width: 100%; + height: 100vh; + background: url("../images/s1200.webp")center no-repeat; + -webkit-background-size: cover; + background-size: cover; +} + +.intro__title { + font-family: 'Playfair Display', serif; + + color: #ffffff; + font-size: 80px; + font-weight: 200; + text-transform: uppercase; + text-align: center; + line-height: 1.5; +} +.intro__title:after { + content: ""; + margin: 20px auto; + display: block; + width: 100%; + height: 5px; + background-color: #FFF; + +} + +.intro_inner { + width: 100%; + max-width: 780px; + margin: 0 auto; +} + +.intro__subtitle { + font-family: 'Dancing Script', cursive; + font-weight: 800; + margin: 15px auto; + color: white; + text-align: center; + font-size: 40px; +} + +/* Header */ + +.header { + padding-top: 20px; + width: 100%; + z-index: 500; + position: absolute; + top: 0; + left: 0; + right: 0; +} + +.headder_inner{ + display: flex; + justify-content: space-between; + align-items: center; +} + +.header__info { + font-size: 30px; + font-weight: 600; + color: #fff; + +} + +/* Contacts */ + +.contacts { + font-size: 14px; + text-transform: uppercase; +} + +.contacts__link { + display: inline-block; + font-size: 20px; + font-weight: 600; + vertical-align: top; + margin: 0 10px; + position: relative; + color: #ffffff; + text-decoration: none; + transition: 0.2s linear; +} + +.contacts__link:after { + content: ""; + display: block; + width: 100%; + height: 2px; + display: none; + + background-color: #ffffff; + position: absolute; + top: 79%; + left: 0; + z-index: 100; + +} + +.contacts__link:hover { + + color: #ffffff; + +} +.contacts__link:hover:after { + display: block; + +} + +/* Section */ + +.section__header { + width: 100%; + max-width: 950px; + margin: 0 auto 40px; + +} + +.section__title { + padding: 20px 0; + font-family: 'Dancing Script', cursive; + font-size: 85px; + margin: 0 auto; + width: 100%; + max-width: 950px 30px; + text-align: center; + text-transform: none; + +} +.section__title:after { + content: ""; + display: block; + margin: 0px auto; + + width: 100px; + height: 3px; + background-color: darkred; + +} + +.section__text { + font-family: 'Saira Semi Condensed', sans-serif; + text-align: center; + color: #333; + font-size: 26px; + font-weight: 400; +} +.section__text:after { + content: ""; + display: block; + margin: 30px auto; + + width: 100%; + height: 3px; + background-color: darkred; +} + +/* About */ + +.section__about { + padding: 80px 0; +} + +.section__about { + background: url("../images/about/background.webp")center no-repeat; + -webkit-background-size: cover; + background-size: cover; + +} + +.about { + display: flex; + justify-content: space-between; + padding: 20px; +} + +.about__item { + margin: 0px auto; + width: 100%; +} + +.about__item:hover { + transform: translate3d(10px,-10px,0) +} + +/* Hobby */ +.section__hobby { + background: url("../images/hobby/background.jpg")center no-repeat; + -webkit-background-size: cover; + background-size: cover; + text-align: center; +} + +.hobby__info { + display: flex; +} + +.hobby__item { + margin: 10px auto; + width: 100%; +} + +.hobby__image { + +} + + +/* Media */ + +@media (max-width:1300px){ + +} diff --git a/HTML/assets/images/about/background.webp b/HTML/assets/images/about/background.webp new file mode 100644 index 0000000..d8ad8c6 Binary files /dev/null and b/HTML/assets/images/about/background.webp differ diff --git a/HTML/assets/images/about/isuct.jpg b/HTML/assets/images/about/isuct.jpg new file mode 100644 index 0000000..0b5c0a5 Binary files /dev/null and b/HTML/assets/images/about/isuct.jpg differ diff --git a/HTML/assets/images/about/me.jpg b/HTML/assets/images/about/me.jpg new file mode 100644 index 0000000..855fa6d Binary files /dev/null and b/HTML/assets/images/about/me.jpg differ diff --git a/HTML/assets/images/about/school.jpg b/HTML/assets/images/about/school.jpg new file mode 100644 index 0000000..a771b26 Binary files /dev/null and b/HTML/assets/images/about/school.jpg differ diff --git a/HTML/assets/images/hobby/background.jpg b/HTML/assets/images/hobby/background.jpg new file mode 100644 index 0000000..d7f60e5 Binary files /dev/null and b/HTML/assets/images/hobby/background.jpg differ diff --git a/HTML/assets/images/hobby/me1.jpg b/HTML/assets/images/hobby/me1.jpg new file mode 100644 index 0000000..fe51e09 Binary files /dev/null and b/HTML/assets/images/hobby/me1.jpg differ diff --git a/HTML/assets/images/hobby/me2.jpg b/HTML/assets/images/hobby/me2.jpg new file mode 100644 index 0000000..ed2a155 Binary files /dev/null and b/HTML/assets/images/hobby/me2.jpg differ diff --git a/HTML/assets/images/hobby/me3.JPG b/HTML/assets/images/hobby/me3.JPG new file mode 100644 index 0000000..039dc50 Binary files /dev/null and b/HTML/assets/images/hobby/me3.JPG differ diff --git a/HTML/assets/images/s1200.webp b/HTML/assets/images/s1200.webp new file mode 100644 index 0000000..593c060 Binary files /dev/null and b/HTML/assets/images/s1200.webp differ diff --git a/HTML/index.html b/HTML/index.html new file mode 100644 index 0000000..592ddb1 --- /dev/null +++ b/HTML/index.html @@ -0,0 +1,117 @@ + + + + + + Summary + + + + + + + + + Summary + + + +
+
+
+
Raskatov Ilya
+ + Telegram + github + Vk + Instagram + +
+
+
+ +
+
+
+

Student's first resume

+

Let me introduce myself

+
+
+
+ +
+
+
+
+

About me

+
+

+ Hello World! My name is Ilya Raskatov, I am a student of group 2/147 of the Ivanovo state University of chemistry and technology. Before joining the University, I studied at school number 39 in Ivanovo. During my free time at school, I do sports, played games, and took an active part in hackathons. At the beginning of 10th and 11th grade, I started learning programming languages: C, C++, and a bit of Java. When I went to University, I continued studying C++. At the beginning of the 2nd course, I got acquainted with a new programming language for me - C#. +

+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+

My hobby

+
+

+ As I mentioned earlier, I do sports. As a teenager, I did swimming and had good achievements. Currently, I am interested in Cycling. In my free time from school and training, I study English.I'm also trying to write this site and make it beautiful. +

+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+ +
+
+
+ +
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index b422454..2cbcc70 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# Tprogramming_147_2019 -Konstantinov Eugeny \ No newline at end of file +Ilya Raskatov 2/147 +https://flamingo-37.github.io/raskatov.github.io/ \ No newline at end of file diff --git a/RPG.Tests/RPG.Tests.csproj b/RPG.Tests/RPG.Tests.csproj new file mode 100644 index 0000000..98af73f --- /dev/null +++ b/RPG.Tests/RPG.Tests.csproj @@ -0,0 +1,31 @@ + + + + netcoreapp2.0 + + false + + + + + + + + + + + + + + + + + + + ../_stylecop/stylecop.ruleset + true + + + + + \ No newline at end of file diff --git a/RPG.Tests/TestingFights.cs b/RPG.Tests/TestingFights.cs new file mode 100644 index 0000000..04f0c32 --- /dev/null +++ b/RPG.Tests/TestingFights.cs @@ -0,0 +1,120 @@ +using System; +using Xunit; +using RPG; + +namespace RPG.Tests +{ + public class TestingFights + { + [Fact] + public void CreationTest() + { + Hero knight = new Knight(); + Hero archer = new Archer(); + Hero wizard = new Wizard(); + Hero necromancer = new Necromancer(); + + if (knight.Health > 0 && knight.Strength > 0 && archer.Health > 0 && archer.Strength > 0 && wizard.Health > 0 && wizard.Strength > 0 && necromancer.Health > 0 && necromancer.Strength > 0) + { + Assert.True(true); + } + } + + [Fact] + public void KnightSkillsTest() + { + Hero knight = new Knight(); + + int damage; + string skillName; + + knight.Skill(out skillName, out damage); + + if ((skillName == "Удар возмездия" || skillName == "Удар с размаху" || skillName == "Раскол земли") && damage > 0) + { + Assert.True(true); + } + } + + [Fact] + public void NecromancerSkillsTest() + { + Hero necromancer = new Necromancer(); + + int damage; + string skillName; + + necromancer.Skill(out skillName, out damage); + + if ((skillName == "Мрачная жатва" || skillName == "Трупное копье" || skillName == "Вампиризм") && damage > 0) + { + Assert.True(true); + } + } + + [Fact] + public void ArcherSkillsTest() + { + Hero archer = new Archer(); + + int damage; + string skillName; + + archer.Skill(out skillName, out damage); + + if (skillName == "Самонаводящаяся стрела" && archer.buf && damage == 0) + { + Assert.True(true); + } + else if ((skillName == "Скоростная стрельба" || skillName == "Стрела стихий") && damage > 0) + { + Assert.True(true); + } + } + + [Fact] + public void WizardSkillsTest() + { + Hero wizard = new Wizard(); + + int damage; + string skillName; + + wizard.Skill(out skillName, out damage); + + if (skillName == "Объятия смерти" && wizard.sleepTime > 0 && damage == 1) + { + Assert.True(true); + } + else if (skillName == "Жатва душ" && damage > 0) + { + Assert.True(true); + } + } + + [Fact] + public void GetDamageTest() + { + Hero wizard = new Wizard(); + + int health = wizard.GetDamage(30); + + Assert.Equal(wizard.maxHealth - 30, health); + } + + [Fact] + public void AtackTest() + { + Hero archer = new Archer(); + + int damage; + + archer.Atack(out damage); + + if (damage > 0) + { + Assert.True(true); + } + } + } +} diff --git a/RPG/Archer.cs b/RPG/Archer.cs new file mode 100644 index 0000000..3a40a9c --- /dev/null +++ b/RPG/Archer.cs @@ -0,0 +1,65 @@ +using System; + +namespace RPG +{ + public class Archer : Hero + { + Random random = new Random(); + + public Archer() + : base() + { + typeClass = "Лучник"; + skills = new string[]{"Самонаводящаяся стрела", "Скоростная стрельба", "Стрела стихий"}; + } + + public override void Skill(out string skillName, out int damage) + { + int probability = random.Next(0, 100); + if(!buf) + { + if(probability <= 15) + { + skillName = "Стрела стихий"; + } + else if(probability <= 70) + { + skillName = "Самонаводящаяся стрела"; + } + else + { + skillName = "Скоростная стрельба"; + } + } + else + { + if(probability <= 50) + { + skillName = "Стрела стихий"; + } + else + { + skillName = "Скоростная стрельба"; + } + } + + switch(skillName) + { + case "Стрела стихий": + damage = (int)(Strength * 1.8); + break; + case "Скоростная стрельба": + damage = (int)(Strength * 2.5); + break; + case "Самонаводящаяся стрела": + bufName = "Самонаводящаяся стрела"; + buf = true; + damage = 0; + break; + default: + damage = 0; + break; + } + } + } +} diff --git a/RPG/Game.cs b/RPG/Game.cs new file mode 100644 index 0000000..0658f27 --- /dev/null +++ b/RPG/Game.cs @@ -0,0 +1,167 @@ +using System; +using System.Collections.Generic; + +namespace RPG +{ + public class Game + { + public List heroes = new List(); + Logger logger = new Logger(); + Random random = new Random(); + Hero hero1; + Hero hero2; + int counter = 0; + + public void Start(int numOfHeroes) + { + CreateHeroes(numOfHeroes); + while(heroes.Count > 1) + { + Fight(); + } + Console.WriteLine($"\n=========\nПобедитель в игре - {heroes[0].typeClass} {heroes[0].Name}\n========="); + } + public void CreateHeroes(int numOfHeroes) + { + while(numOfHeroes > 0) + { + switch(random.Next(0,4)) + { + case 0: + heroes.Add(new Archer()); + break; + case 1: + heroes.Add(new Knight()); + break; + case 2: + heroes.Add(new Wizard()); + break; + case 3: + heroes.Add(new Necromancer()); + break; + default: + heroes.Add(new Wizard()); + break; + } + numOfHeroes--; + } + } + public void Atack(Hero hero1, Hero hero2) + { + int damage; + + if(hero1.buf) + { + hero1.Atack(out damage); + logger.Atack(hero1, hero2, damage); + hero2.GetDamage(damage + 10); + } + else + { + hero1.Atack(out damage); + logger.Atack(hero1, hero2, damage); + hero2.GetDamage(damage); + } + } + public void UseSkill(Hero hero1, Hero hero2) + { + int damage; + string skillName; + + if(hero1.buf) + { + hero1.Skill(out skillName, out damage); + logger.Skill(hero1, hero2, skillName, damage); + hero2.GetDamage(damage + 10); + } + else + { + hero1.Skill(out skillName, out damage); + logger.Skill(hero1, hero2, skillName, damage); + hero2.GetDamage(damage); + } + } + + public void Fight() + { + int i = random.Next(0, heroes.Count - 1); + hero1 = heroes[i]; + heroes.RemoveAt(i); + + i = random.Next(0, heroes.Count); + hero2 = heroes[i]; + heroes.RemoveAt(i); + + int turn = random.Next(0, 1); + counter++; + Console.WriteLine("========="); + Console.WriteLine($"Бой №{counter}"); + + while (true) + { + if(turn == 0) + { + if(hero2.sleepTime == 0) + { + if(random.Next(0,10) > 6) + { + UseSkill(hero1, hero2); + } + else + { + Atack(hero1, hero2); + } + } + else + { + logger.Sleep(hero1); + hero2.sleepTime--; + } + + if(hero2.Health <= 0) + { + hero1.sleepTime = 0; + hero1.buf = false; + heroes.Add(hero1); + logger.Winner(hero1); + logger.Death(hero2); + break; + } + + turn = 1; + } + else + { + if(hero1.sleepTime == 0) + { + if(random.Next(0,10) > 6) + { + UseSkill(hero2, hero1); + } + else + { + Atack(hero2, hero1); + } + } + + else + { + logger.Sleep(hero2); + hero1.sleepTime--; + } + + if(hero1.Health <= 0) + { + hero2.sleepTime = 0; + hero2.buf = false; + heroes.Add(hero2); + logger.Winner(hero2); + logger.Death(hero1); + break; + } + turn = 0; + } + } + } + } +} diff --git a/RPG/Hero.cs b/RPG/Hero.cs new file mode 100644 index 0000000..d63c850 --- /dev/null +++ b/RPG/Hero.cs @@ -0,0 +1,55 @@ +using System; + +namespace RPG +{ + public class Hero + { + Random random = new Random(); + public string Name { get; protected set; } + public int Strength { get; protected set; } + public int Health { get; set; } + public string typeClass; + public string[] skills; + public string skillName; + public bool buf = false; + public string bufName; + public int sleepTime = 0; + public int maxHealth; + public Hero() + { + Health = random.Next(100,300); + maxHealth = Health; + Name = Names[random.Next(0,9)]; + Strength = random.Next(10,50); + } + public static string[] Names = new string[10]{ + "Player1", + "Player2", + "Player3", + "Player4", + "Player5", + "Player6", + "Player7", + "Player8", + "Player9", + "Player10" + }; + + public virtual void Skill(out string skillName, out int damage) + { + skillName = ""; + damage = 0; + } + + public void Atack(out int damage) + { + damage = random.Next(1, Strength); + } + + public int GetDamage(int damage) + { + Health -= damage; + return Health; + } + } +} diff --git a/RPG/Knight.cs b/RPG/Knight.cs new file mode 100644 index 0000000..953dcaa --- /dev/null +++ b/RPG/Knight.cs @@ -0,0 +1,50 @@ +using System; + +namespace RPG +{ + public class Knight : Hero + { + Random random = new Random(); + + public Knight() + : base() + { + typeClass = "Рыцарь"; + skills = new string[]{"Удар возмездия", "Удар с размаху", "Раскол земли"}; + } + + public override void Skill(out string skillName, out int damage) + { + int probability = random.Next(0, 100); + if(probability <= 20) + { + skillName = "Удар возмездия"; + } + else if(probability <= 90) + { + skillName = "Удар с размаху"; + } + else + { + skillName = "Раскол земли"; + } + + switch(skillName) + { + case "Удар возмездия": + damage = (int)Math.Floor(Strength * 1.5); + break; + case "Удар с размаху": + damage = (int)Math.Floor(Strength * 1.8); + break; + case "Раскол земли": + sleepTime = 3; + damage = (int)Math.Floor(Strength * 2.5); + break; + default: + damage = 0; + break; + } + } + } +} diff --git a/RPG/Logger.cs b/RPG/Logger.cs new file mode 100644 index 0000000..289a1b7 --- /dev/null +++ b/RPG/Logger.cs @@ -0,0 +1,80 @@ +using System; + +namespace RPG +{ + class Logger + { + public void Atack(Hero hero1, Hero hero2, int damage) + { + if(hero1.typeClass == "Рыцарь") + { + Console.Write($"{hero1.Name} {hero1.typeClass} ({hero1.Health} / {hero1.maxHealth}) ударил мечом {hero2.Name} {hero2.typeClass} ({hero2.Health} / {hero2.maxHealth}) и нанёс {damage} урона."); + } + else if(hero1.typeClass == "Лучник") + { + Console.Write($"{hero1.Name} {hero1.typeClass} ({hero1.Health} / {hero1.maxHealth}) выстрелил в {hero2.Name} {hero2.typeClass} ({hero2.Health} / {hero2.maxHealth}) и нанёс {damage} урона."); + } + else if(hero1.typeClass == "Маг") + { + Console.Write($"{hero1.Name} {hero1.typeClass} ({hero1.Health} / {hero1.maxHealth}) ударил посохом {hero2.Name} {hero2.typeClass} ({hero2.Health} / {hero2.maxHealth}) и нанёс {damage} урона."); + } + else + { + Console.Write($"{hero1.Name} {hero1.typeClass} ({hero1.Health} / {hero1.maxHealth}) ударил {hero2.Name} {hero2.typeClass} ({hero2.Health} / {hero2.maxHealth}) и нанёс {damage} урона."); + } + + if(hero1.buf) + { + Console.WriteLine($" Дополнительный урон 10 единиц из-за усиления \"{hero1.bufName}\"."); + } + else + { + Console.WriteLine(); + } + } + + public void Skill(Hero hero1, Hero hero2, string skillName, int damage) + { + if(hero1.sleepTime > 0 && damage == 0) + { + Console.WriteLine($"{hero1.Name} {hero1.typeClass} ({hero1.Health} / {hero1.maxHealth}) использует умение \"{skillName}\" и оглушает {hero2.Name} {hero2.typeClass} ({hero2.Health} / {hero2.maxHealth}) на {hero1.sleepTime} хода."); + } + else if(hero1.sleepTime > 1) + { + Console.WriteLine($"{hero1.Name} {hero1.typeClass} ({hero1.Health} / {hero1.maxHealth}) использовал(-a) умение \"{skillName}\" и нанес {hero2.Name} {hero2.typeClass} {damage} урона. {hero2.Name} {hero2.typeClass} ({hero2.Health} / {hero2.maxHealth}) оглушен на {hero1.sleepTime} ход(-а)."); + } + else if(hero1.buf && damage == 0) + { + Console.WriteLine($"{hero1.Name} {hero1.typeClass} ({hero1.Health} / {hero1.maxHealth}) активировал усиление \"{skillName}\""); + } + else + { + Console.Write($"{hero1.Name} {hero1.typeClass} ({hero1.Health} / {hero1.maxHealth}) использовал умение \"{skillName}\" и нанес {hero2.Name} {hero2.typeClass} ({hero2.Health} / {hero2.maxHealth}) {damage} урона."); + + if(hero1.buf) + { + Console.WriteLine($" Дополнительный урон 10 единиц из-за усиления \"{hero1.bufName}\"."); + } + else + { + Console.WriteLine(); + } + } + } + + public void Sleep(Hero hero) + { + Console.WriteLine($"{hero.Name} {hero.typeClass} ({hero.Health} / {hero.maxHealth}) оглушен и пропускает ход."); + } + + public void Winner(Hero hero) + { + Console.WriteLine($"{hero.Name} {hero.typeClass} ({hero.Health} / {hero.maxHealth}) победил!"); + } + + public void Death(Hero hero) + { + Console.WriteLine($"{hero.Name} {hero.typeClass} погибает"); + } + } +} diff --git a/RPG/Necromancer.cs b/RPG/Necromancer.cs new file mode 100644 index 0000000..c90da17 --- /dev/null +++ b/RPG/Necromancer.cs @@ -0,0 +1,65 @@ +using System; + +namespace RPG +{ + public class Necromancer : Hero + { + Random random = new Random(); + + public Necromancer() + : base() + { + typeClass = "Некромант"; + skills = new string[]{"Мрачная жатва", "Трупное копье", "Вампиризм"}; + } + + public override void Skill(out string skillName, out int damage) + { + int probability = random.Next(0, 100); + if(!buf) + { + if(probability <= 15) + { + skillName = "Вампиризм"; + } + else if(probability <= 70) + { + skillName = "Мрачная жатва"; + } + else + { + skillName = "Трупное копье"; + } + } + else + { + if(probability <= 50) + { + skillName = "Вампиризм"; + } + else + { + skillName = "Трупное копье"; + } + } + + switch(skillName) + { + case "Вампиризм": + damage = (int)(Strength * 1.8); + break; + case "Мрачная жатва": + damage = (int)(Strength * 2.5); + break; + case "Трупное копье": + bufName = "Трупное копье"; + buf = true; + damage = 0; + break; + default: + damage = 0; + break; + } + } + } +} diff --git a/RPG/Program.cs b/RPG/Program.cs new file mode 100644 index 0000000..dec3ee2 --- /dev/null +++ b/RPG/Program.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; + +namespace RPG +{ + class Program + { + static void Main(string[] args) + { + Game game = new Game(); + Console.Write("Введите число героев: "); + int numOfHeroes = Int32.Parse(Console.ReadLine()); + + if(numOfHeroes % 2 != 0) + { + numOfHeroes += 1; + } + + game.Start(numOfHeroes); + + Console.ReadKey(); + } + } +} diff --git a/RPG/RPG.csproj b/RPG/RPG.csproj new file mode 100644 index 0000000..f94b956 --- /dev/null +++ b/RPG/RPG.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.0 + + + \ No newline at end of file diff --git a/RPG/Wizard.cs b/RPG/Wizard.cs new file mode 100644 index 0000000..140aeed --- /dev/null +++ b/RPG/Wizard.cs @@ -0,0 +1,43 @@ +using System; + +namespace RPG +{ + public class Wizard : Hero + { + Random random = new Random(); + + public Wizard() + : base() + { + skills = new string[]{"Объятия смерти","Жатва душ"}; + typeClass = "Маг"; + } + + public override void Skill(out string skillName, out int damage) + { + int probability = random.Next(0, 100); + if(probability <= 60 && sleepTime == 0) + { + skillName = "Объятия смерти"; + } + else + { + skillName = "Жатва душ"; + } + + switch(skillName) + { + case "Объятия смерти": + sleepTime = 5; + damage = 1; + break; + case "Жатва душ": + damage = (int)Math.Floor(Strength * 1.5); + break; + default: + damage = 1; + break; + } + } + } +} diff --git a/courseworkspace.code-workspace b/courseworkspace.code-workspace index 4f9af01..9959a25 100644 --- a/courseworkspace.code-workspace +++ b/courseworkspace.code-workspace @@ -5,6 +5,15 @@ }, { "path": "CourseApp.Tests" + }, + { + "path": "RPG" + }, + { + "path": "RPG.Tests" + }, + { + "path": "raskatov_ilya.github.io" } ], "settings": {}