diff --git a/Trunk/Components/CzokoŚmieciarka.AI_Naive/DFS.cs b/Trunk/Components/CzokoŚmieciarka.AI_Naive/DFS.cs deleted file mode 100644 index d20dd7a..0000000 --- a/Trunk/Components/CzokoŚmieciarka.AI_Naive/DFS.cs +++ /dev/null @@ -1,109 +0,0 @@ -using CzokoŚmieciarka.DataModels.Enums; -using CzokoŚmieciarka.DataModels.Interfaces; -using CzokoŚmieciarka.DataModels.Interfaces.GarbageCollector; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; -using CzokoŚmieciarka.DataModels.Models; -using CzokoŚmieciarka.DataModels.Models.Steps; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CzokoŚmieciarka.AI_Naive -{ - public class DFS - { - public DFS() - { - } - int count = 0; - - - public List BestPath(AGarbageCollector collector, object[,] grid) - { - var r=Search(collector, grid, 0).Key; - Console.WriteLine(count); - return r; - } - - List PossibleSteps(AGarbageCollector collector, object[,] grid) - { - - - var result = new List(); - var moveSteps = new List() - { - new MoveStep(Direction.Up), - new MoveStep(Direction.Down), - new MoveStep(Direction.Left), - new MoveStep(Direction.Right) - }; - var filteredMoveSteps = new List(); - foreach (var item in moveSteps) - { - var copyCollector = (AGarbageCollector)collector.Clone(); - var copyGrid = (object[,])grid.Clone(); - try - { - item.Invoke(copyCollector, grid); - var gcx = copyCollector.Coords.X; - var gcy = copyCollector.Coords.Y; - if (grid[gcx, gcy] is IRoad1 || grid[gcx, gcy] is IGarbageLocalization || grid[gcx, gcy] is ADump) - { - result.Add(item); - } - } - catch (Exception e) - { - - } - } - - return result; - } - - KeyValuePair, int> Search(AGarbageCollector collector, object[,] grid, int length) - { - count++; - if (length > 40) return new KeyValuePair, int>(new List(), length); - var possibleSteps = PossibleSteps(collector, grid); - - foreach (var item in possibleSteps) - { - var copyCollector = (AGarbageCollector)collector.Clone(); - var copyGrid = (object[,])grid.Clone(); - - - - - - - - //if (copyGrid[copyCollector.Coords.X, copyCollector.Coords.Y] is IRoad1) copyGrid[copyCollector.Coords.X, copyCollector.Coords.Y] = new Road2(); - item.Invoke(copyCollector, copyGrid); - var s = Search(copyCollector, copyGrid, length + 1); - if (s.Key != null) - { - s.Key.Insert(0, item); - return s; - } - } - return new KeyValuePair, int>(null, length); - /*var min = int.MaxValue; - var min_index = 0; - for (int i = 0; i < mapped.Count; i++) - { - if (mapped.ElementAt(i).Value <= min) - { - min = mapped.ElementAt(i).Value; - min_index = i; - } - } - return mapped.ElementAt(min_index); - */ - - - } - } -} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/Dump.cs b/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/Dump.cs deleted file mode 100644 index ea9d2b7..0000000 --- a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/Dump.cs +++ /dev/null @@ -1,13 +0,0 @@ -using CzokoŚmieciarka.DataModels.Interfaces; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; -using CzokoŚmieciarka.DataModels.Models; - -namespace CzokoŚmieciarka.DataModels.GeneralModels.Models -{ - public class Dump : ADump - { - public Dump(ITypeOfGarbage typeOfGarbage, int maxVolume, Coords localization) : base(typeOfGarbage, maxVolume, localization) - { - } - } -} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/GarbageCollector.cs b/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/GarbageCollector.cs deleted file mode 100644 index 5a224df..0000000 --- a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/GarbageCollector.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Collections.Generic; -using CzokoŚmieciarka.DataModels.Interfaces.GarbageCollector; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; -using CzokoŚmieciarka.DataModels.Models; - -namespace CzokoŚmieciarka.DataModels.GeneralModels.Models -{ - public class GarbageCollector : AGarbageCollector - { - public GarbageCollector(Coords startPosition, IEnumerable trashContainers, int columns, int rows) : base(startPosition, trashContainers, columns, rows) - { - } - } -} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/CzokoŚmieciarka.DataModels.csproj b/Trunk/Components/CzokoŚmieciarka.DataModels/CzokoŚmieciarka.DataModels.csproj index d200d86..f1402e1 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/CzokoŚmieciarka.DataModels.csproj +++ b/Trunk/Components/CzokoŚmieciarka.DataModels/CzokoŚmieciarka.DataModels.csproj @@ -42,32 +42,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + \ No newline at end of file diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Exceptions/OutOfGridException.cs b/Trunk/Components/CzokoŚmieciarka.DataModels/Exceptions/OutOfGridException.cs deleted file mode 100644 index a0c69cc..0000000 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Exceptions/OutOfGridException.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CzokoŚmieciarka.DataModels.Exceptions -{ - public class OutOfGridException : Exception - { - public OutOfGridException() - { - } - public OutOfGridException(string message) - : base(message) - { - } - - public OutOfGridException(string message, Exception inner) - : base(message, inner) - { - } - } -} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IStep.cs b/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IStep.cs deleted file mode 100644 index 10f537f..0000000 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IStep.cs +++ /dev/null @@ -1,9 +0,0 @@ -using CzokoŚmieciarka.DataModels.Interfaces.GarbageCollector; - -namespace CzokoŚmieciarka.DataModels.Interfaces -{ - public interface IStep - { - void Invoke(IGarbageCollector collector, object [,] grid); - } -} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Road1.cs b/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Road1.cs deleted file mode 100644 index 88f8ec8..0000000 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Road1.cs +++ /dev/null @@ -1,13 +0,0 @@ -using CzokoŚmieciarka.DataModels.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CzokoŚmieciarka.DataModels.Models -{ - public class Road1 :IRoad1 - { - } -} diff --git a/Trunk/CzokoŚmieciarka.sln b/Trunk/CzokoŚmieciarka.sln index 7342d94..c584a58 100644 --- a/Trunk/CzokoŚmieciarka.sln +++ b/Trunk/CzokoŚmieciarka.sln @@ -3,14 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.28307.136 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CzokoŚmieciarka.DataModels", "Components\CzokoŚmieciarka.DataModels\CzokoŚmieciarka.DataModels.csproj", "{F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CzokoŚmieciarka.DataModels.GeneralModels", "Components\CzokoŚmieciarka.DataModels.GeneralModels\CzokoŚmieciarka.DataModels.GeneralModels.csproj", "{A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CzokoŚmieciarka.WPFv2", "Interface\CzokoŚmieciarka.WPFv2\CzokoŚmieciarka.WPFv2.csproj", "{2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CzokoŚmieciarka.AI_Naive", "Components\CzokoŚmieciarka.AI_Naive\CzokoŚmieciarka.AI_Naive.csproj", "{10E77BBE-55E1-483D-A456-0E94EAC9B24A}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGameView", "MonoGameView\MonoGameView.csproj", "{EBE9431C-9B66-4300-B288-7A0F7B899415}" EndProject Global @@ -25,70 +17,6 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Debug|ARM.ActiveCfg = Debug|Any CPU - {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Debug|ARM.Build.0 = Debug|Any CPU - {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Debug|x64.ActiveCfg = Debug|Any CPU - {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Debug|x64.Build.0 = Debug|Any CPU - {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Debug|x86.ActiveCfg = Debug|Any CPU - {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Debug|x86.Build.0 = Debug|Any CPU - {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Release|Any CPU.Build.0 = Release|Any CPU - {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Release|ARM.ActiveCfg = Release|Any CPU - {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Release|ARM.Build.0 = Release|Any CPU - {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Release|x64.ActiveCfg = Release|Any CPU - {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Release|x64.Build.0 = Release|Any CPU - {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Release|x86.ActiveCfg = Release|Any CPU - {F2E11FEE-C5AC-47D2-BA9C-819909B6DFF7}.Release|x86.Build.0 = Release|Any CPU - {A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Debug|ARM.ActiveCfg = Debug|Any CPU - {A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Debug|ARM.Build.0 = Debug|Any CPU - {A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Debug|x64.ActiveCfg = Debug|Any CPU - {A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Debug|x64.Build.0 = Debug|Any CPU - {A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Debug|x86.ActiveCfg = Debug|Any CPU - {A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Debug|x86.Build.0 = Debug|Any CPU - {A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Release|Any CPU.Build.0 = Release|Any CPU - {A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Release|ARM.ActiveCfg = Release|Any CPU - {A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Release|ARM.Build.0 = Release|Any CPU - {A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Release|x64.ActiveCfg = Release|Any CPU - {A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Release|x64.Build.0 = Release|Any CPU - {A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Release|x86.ActiveCfg = Release|Any CPU - {A3D5DA96-69D7-463F-B1EE-6FC70716E3B2}.Release|x86.Build.0 = Release|Any CPU - {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Debug|ARM.ActiveCfg = Debug|Any CPU - {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Debug|ARM.Build.0 = Debug|Any CPU - {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Debug|x64.ActiveCfg = Debug|Any CPU - {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Debug|x64.Build.0 = Debug|Any CPU - {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Debug|x86.ActiveCfg = Debug|Any CPU - {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Debug|x86.Build.0 = Debug|Any CPU - {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Release|Any CPU.Build.0 = Release|Any CPU - {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Release|ARM.ActiveCfg = Release|Any CPU - {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Release|ARM.Build.0 = Release|Any CPU - {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Release|x64.ActiveCfg = Release|Any CPU - {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Release|x64.Build.0 = Release|Any CPU - {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Release|x86.ActiveCfg = Release|Any CPU - {2BADDDA9-A77C-4FB2-9F28-4DAE712E8947}.Release|x86.Build.0 = Release|Any CPU - {10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Debug|ARM.ActiveCfg = Debug|Any CPU - {10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Debug|ARM.Build.0 = Debug|Any CPU - {10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Debug|x64.ActiveCfg = Debug|Any CPU - {10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Debug|x64.Build.0 = Debug|Any CPU - {10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Debug|x86.ActiveCfg = Debug|Any CPU - {10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Debug|x86.Build.0 = Debug|Any CPU - {10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Release|Any CPU.Build.0 = Release|Any CPU - {10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Release|ARM.ActiveCfg = Release|Any CPU - {10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Release|ARM.Build.0 = Release|Any CPU - {10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Release|x64.ActiveCfg = Release|Any CPU - {10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Release|x64.Build.0 = Release|Any CPU - {10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Release|x86.ActiveCfg = Release|Any CPU - {10E77BBE-55E1-483D-A456-0E94EAC9B24A}.Release|x86.Build.0 = Release|Any CPU {EBE9431C-9B66-4300-B288-7A0F7B899415}.Debug|Any CPU.ActiveCfg = Debug|x86 {EBE9431C-9B66-4300-B288-7A0F7B899415}.Debug|Any CPU.Build.0 = Debug|x86 {EBE9431C-9B66-4300-B288-7A0F7B899415}.Debug|ARM.ActiveCfg = Debug|x86 diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Content.mgcb b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Content.mgcb new file mode 100644 index 0000000..297518a --- /dev/null +++ b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Content.mgcb @@ -0,0 +1,118 @@ + +#----------------------------- Global Properties ----------------------------# + +/outputDir:bin/$(Platform) +/intermediateDir:obj/$(Platform) +/platform:Windows +/config: +/profile:Reach +/compress:False + +#-------------------------------- References --------------------------------# + + +#---------------------------------- Content ---------------------------------# + +#begin Font.spritefont +/importer:FontDescriptionImporter +/processor:FontDescriptionProcessor +/processorParam:PremultiplyAlpha=True +/processorParam:TextureFormat=Compressed +/build:Font.spritefont + +#begin Images/Dumps/glass.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Images/Dumps/glass.png + +#begin Images/Dumps/organic.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Images/Dumps/organic.png + +#begin Images/Dumps/paper.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Images/Dumps/paper.png + +#begin Images/Dumps/plasticmetal.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Images/Dumps/plasticmetal.png + +#begin Images/garbageCollector.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Images/garbageCollector.png + +#begin Images/house.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Images/house.png + +#begin Images/intersection.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Images/intersection.png + +#begin Images/intersectionRED.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:Images/intersectionRED.png + diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Font.spritefont b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Font.spritefont new file mode 100644 index 0000000..bd33ecf --- /dev/null +++ b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Font.spritefont @@ -0,0 +1,60 @@ + + + + + + + Arial + + + 12 + + + 0 + + + true + + + + + + + + + + + + ~ + + + + diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/Dumps/glass.png b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/Dumps/glass.png new file mode 100644 index 0000000..60a475e Binary files /dev/null and b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/Dumps/glass.png differ diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/Dumps/organic.png b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/Dumps/organic.png new file mode 100644 index 0000000..fec2e9e Binary files /dev/null and b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/Dumps/organic.png differ diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/Dumps/paper.png b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/Dumps/paper.png new file mode 100644 index 0000000..548493e Binary files /dev/null and b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/Dumps/paper.png differ diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/Dumps/plasticmetal.png b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/Dumps/plasticmetal.png new file mode 100644 index 0000000..cbf47a7 Binary files /dev/null and b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/Dumps/plasticmetal.png differ diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/garbageCollector.png b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/garbageCollector.png new file mode 100644 index 0000000..3283e83 Binary files /dev/null and b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/garbageCollector.png differ diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/house.png b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/house.png new file mode 100644 index 0000000..c69da1e Binary files /dev/null and b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/house.png differ diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/intersection.png b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/intersection.png new file mode 100644 index 0000000..c57ed66 Binary files /dev/null and b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/intersection.png differ diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/intersectionRED.png b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/intersectionRED.png new file mode 100644 index 0000000..3914a2d Binary files /dev/null and b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Images/intersectionRED.png differ diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/CzokoŚmieciarka.MonoGame.csproj b/Trunk/Interface/CzokoŚmieciarka.MonoGame/CzokoŚmieciarka.MonoGame.csproj new file mode 100644 index 0000000..abc7533 --- /dev/null +++ b/Trunk/Interface/CzokoŚmieciarka.MonoGame/CzokoŚmieciarka.MonoGame.csproj @@ -0,0 +1,91 @@ + + + + + Debug + x86 + 8.0.30703 + 2.0 + {3A27CBFB-44DF-4B1D-B776-770FCA3DF905} + WinExe + Properties + CzokoŚmieciarka.MonoGame + CzokoŚmieciarka.MonoGame + 512 + Windows + v4.5 + + + x86 + true + full + false + bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\ + DEBUG;TRACE;WINDOWS + prompt + 4 + + + x86 + pdbonly + true + bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\ + TRACE;WINDOWS + prompt + 4 + + + Icon.ico + + + app.manifest + + + + + + + + + + + + + + + $(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\Windows\MonoGame.Framework.dll + + + + + + + + + + + + + + {10e77bbe-55e1-483d-a456-0e94eac9b24a} + CzokoŚmieciarka.AI_Naive + + + {a3d5da96-69d7-463f-b1ee-6fc70716e3b2} + CzokoŚmieciarka.DataModels.GeneralModels + + + {f2e11fee-c5ac-47d2-ba9c-819909b6dff7} + CzokoŚmieciarka.DataModels + + + + + + \ No newline at end of file diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/Game1.cs b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Game1.cs new file mode 100644 index 0000000..d0cd7db --- /dev/null +++ b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Game1.cs @@ -0,0 +1,94 @@ +using System.Collections.Generic; +using CzokoŚmieciarka.MonoGame.Interfaces; +using CzokoŚmieciarka.MonoGame.Models; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; + +namespace CzokoŚmieciarka.MonoGame +{ + /// + /// This is the main type for your game. + /// + public class Game1 : Game + { + GraphicsDeviceManager graphics; + SpriteBatch spriteBatch; + private Texture2D road; + private IWPFObject[,] Objects = new IWPFObject[9, 9]; + private IEnumerable GarbageCollectorContainers; + private WPFGarbageCollector garbageCollector; + + public Game1() + { + graphics = new GraphicsDeviceManager(this); + Content.RootDirectory = "Content"; + } + + /// + /// Allows the game to perform any initialization it needs to before starting to run. + /// This is where it can query for any required services and load any non-graphic + /// related content. Calling base.Initialize will enumerate through any components + /// and initialize them as well. + /// + protected override void Initialize() + { + // TODO: Add your initialization logic here + + base.Initialize(); + } + + /// + /// LoadContent will be called once per game and is the place to load + /// all of your content. + /// + protected override void LoadContent() + { + // Create a new SpriteBatch, which can be used to draw textures. + spriteBatch = new SpriteBatch(GraphicsDevice); + road = Content.Load("Images/intersection"); + // TODO: use this.Content to load your game content here + } + + /// + /// UnloadContent will be called once per game and is the place to unload + /// game-specific content. + /// + protected override void UnloadContent() + { + // TODO: Unload any non ContentManager content here + Content.Unload(); + } + + /// + /// Allows the game to run logic such as updating the world, + /// checking for collisions, gathering input, and playing audio. + /// + /// Provides a snapshot of timing values. + protected override void Update(GameTime gameTime) + { + if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) + Exit(); + + // TODO: Add your update logic here + + base.Update(gameTime); + } + + /// + /// This is called when the game should draw itself. + /// + /// Provides a snapshot of timing values. + protected override void Draw(GameTime gameTime) + { + GraphicsDevice.Clear(Color.CornflowerBlue); + + // TODO: Add your drawing code here + + spriteBatch.Begin(); + spriteBatch.Draw(road, new Rectangle(0,0,40,40),Color.White); + spriteBatch.End(); + base.Draw(gameTime); + } + } +} diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/Icon.ico b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Icon.ico new file mode 100644 index 0000000..7d9dec1 Binary files /dev/null and b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Icon.ico differ diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/Interfaces/IWPFObject.cs b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Interfaces/IWPFObject.cs new file mode 100644 index 0000000..7606df3 --- /dev/null +++ b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Interfaces/IWPFObject.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + +namespace CzokoŚmieciarka.MonoGame.Interfaces +{ + public interface IWPFObject + { + Coords Coords { get; set; } + } +} diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/Models/Dump.cs b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Models/Dump.cs new file mode 100644 index 0000000..4e43c94 --- /dev/null +++ b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Models/Dump.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CzokoŚmieciarka.DataModels.Enums; +using CzokoŚmieciarka.DataModels.GeneralModels.Models; +using CzokoŚmieciarka.DataModels.Interfaces; +using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.DataModels.Models; +using CzokoŚmieciarka.MonoGame.Interfaces; + +namespace CzokoŚmieciarka.MonoGame.Models +{ + class WPFDump : ADump, IWPFObject + { + public string ImagePath { get; set; } + + public WPFDump(ITypeOfGarbage typeofGarbage, int maxVolume, Coords localization) : base ( typeofGarbage, maxVolume, localization) + { + switch (typeofGarbage.GarbageType) + { + case GarbageType.Glass: + ImagePath = AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\Dumps\glass.png"; + break; + case GarbageType.PlasticMetal: + ImagePath = AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\Dumps\plasticmetal.png"; + break; + case GarbageType.Organic: + ImagePath = AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\Dumps\organic.png"; + break; + case GarbageType.Paper: + ImagePath = AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\Dumps\paper.png"; + break; + } + } + } +} diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/Models/GarbageCollector.cs b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Models/GarbageCollector.cs new file mode 100644 index 0000000..f20de22 --- /dev/null +++ b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Models/GarbageCollector.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; +using CzokoŚmieciarka.DataModels.Interfaces.GarbageCollector; +using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.DataModels.Models; +using CzokoŚmieciarka.MonoGame.Interfaces; + +namespace CzokoŚmieciarka.MonoGame.Models +{ + class WPFGarbageCollector : AGarbageCollector, IWPFObject, INotifyPropertyChanged + { + + + public WPFGarbageCollector(Coords startPosition, IEnumerable trashContainers, int columns, int rows) : base(startPosition, trashContainers, columns, rows) + { + + } + + public event PropertyChangedEventHandler PropertyChanged; + + [NotifyPropertyChangedInvocator] + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + + + } +} diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/Models/House.cs b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Models/House.cs new file mode 100644 index 0000000..d7d4de1 --- /dev/null +++ b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Models/House.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CzokoŚmieciarka.DataModels.Interfaces; +using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.DataModels.Models; +using CzokoŚmieciarka.MonoGame.Interfaces; + +namespace CzokoŚmieciarka.MonoGame.Models +{ + class WPFHouse : IGarbageLocalization, IWPFObject + { + public Coords Coords { get; set; } + public IEnumerable TrashCans { get; set; } + + + public WPFHouse(Coords coords, IEnumerable trashCans) + { + TrashCans = trashCans; + Coords = coords; + } + } +} diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/Models/Road.cs b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Models/Road.cs new file mode 100644 index 0000000..5b667f1 --- /dev/null +++ b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Models/Road.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Mime; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Controls; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using CzokoŚmieciarka.DataModels.Models; +using CzokoŚmieciarka.MonoGame.Interfaces; + +namespace CzokoŚmieciarka.MonoGame.Models +{ + class Road : IWPFObject + { + public MediaTypeNames.Image Image + { + get + { + return new MediaTypeNames.Image + { + Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\intersection.png")), + Width = 100, + Height = 100 + }; + } + } + + public Road() + { + //Image = new Image() + //{ + // Source = + // new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\intersection.png")) + //}; + } + + public Coords Coords { get; set; } + } +} diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/Models/Road2.cs b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Models/Road2.cs new file mode 100644 index 0000000..bb5fd79 --- /dev/null +++ b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Models/Road2.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CzokoŚmieciarka.DataModels.Models; +using CzokoŚmieciarka.MonoGame.Interfaces; + +namespace CzokoŚmieciarka.MonoGame.Models +{ + class Road2 : IWPFObject + { + public string ImagePath { get; set; } + public Coords Coords { get; set; } + + public Road2() + { + } + } +} diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/Program.cs b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Program.cs new file mode 100644 index 0000000..dab9e40 --- /dev/null +++ b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Program.cs @@ -0,0 +1,22 @@ +using System; + +namespace CzokoŚmieciarka.MonoGame +{ +#if WINDOWS || LINUX + /// + /// The main class. + /// + public static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + using (var game = new Game1()) + game.Run(); + } + } +#endif +} diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/Properties/AssemblyInfo.cs b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ee41ef7 --- /dev/null +++ b/Trunk/Interface/CzokoŚmieciarka.MonoGame/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CzokoŚmieciarka.MonoGame")] +[assembly: AssemblyProduct("CzokoŚmieciarka.MonoGame")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3cdbdf0b-e65f-481e-83b9-45c21a07b884")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Trunk/Interface/CzokoŚmieciarka.MonoGame/app.manifest b/Trunk/Interface/CzokoŚmieciarka.MonoGame/app.manifest new file mode 100644 index 0000000..77b9e59 --- /dev/null +++ b/Trunk/Interface/CzokoŚmieciarka.MonoGame/app.manifest @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true/pm + + + + diff --git a/Trunk/Interface/CzokoŚmieciarka.WPFv2/CzokoŚmieciarka.WPFv2.csproj b/Trunk/Interface/CzokoŚmieciarka.WPFv2/CzokoŚmieciarka.WPFv2.csproj index 69761c4..e146b90 100644 --- a/Trunk/Interface/CzokoŚmieciarka.WPFv2/CzokoŚmieciarka.WPFv2.csproj +++ b/Trunk/Interface/CzokoŚmieciarka.WPFv2/CzokoŚmieciarka.WPFv2.csproj @@ -102,20 +102,6 @@ - - - {10e77bbe-55e1-483d-a456-0e94eac9b24a} - CzokoŚmieciarka.AI_Naive - - - {a3d5da96-69d7-463f-b1ee-6fc70716e3b2} - CzokoŚmieciarka.DataModels.GeneralModels - - - {f2e11fee-c5ac-47d2-ba9c-819909b6dff7} - CzokoŚmieciarka.DataModels - - \ No newline at end of file diff --git a/Trunk/Interface/CzokoŚmieciarka.WPFv2/MainWindow.xaml b/Trunk/Interface/CzokoŚmieciarka.WPFv2/MainWindow.xaml index fe91d13..f18bd30 100644 --- a/Trunk/Interface/CzokoŚmieciarka.WPFv2/MainWindow.xaml +++ b/Trunk/Interface/CzokoŚmieciarka.WPFv2/MainWindow.xaml @@ -5,12 +5,10 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:CzokoŚmieciarka.WPFv2" mc:Ignorable="d" - Title="MainWindow" Height="800" Width="1000" + Title="MainWindow" Height="800" Width="800" KeyDown="MainWindow_OnKeyDown"> - - - - + + diff --git a/Trunk/Interface/CzokoŚmieciarka.WPFv2/MainWindow.xaml.cs b/Trunk/Interface/CzokoŚmieciarka.WPFv2/MainWindow.xaml.cs index 61d7729..8eb0dd9 100644 --- a/Trunk/Interface/CzokoŚmieciarka.WPFv2/MainWindow.xaml.cs +++ b/Trunk/Interface/CzokoŚmieciarka.WPFv2/MainWindow.xaml.cs @@ -49,18 +49,17 @@ namespace CzokoŚmieciarka.WPFv2 //routePlanningEngine.PerformStep(); } - CollectorBoard.Children.Clear(); - Grid.SetColumn(garbageCollector.Image, garbageCollector.Coords.X); - Grid.SetRow(garbageCollector.Image, garbageCollector.Coords.Y); - CollectorBoard.Children.Add(garbageCollector.Image); Board.Children.Clear(); - for (int x=0;x() @@ -120,10 +109,9 @@ namespace CzokoŚmieciarka.WPFv2 new GarbageCollectorContainer(new TypeOfGarbage(GarbageType.Paper, 1,1), 500) }; garbageCollector = new WPFGarbageCollector(new Coords(2, 1), GarbageCollectorContainers, Columns, Rows); - Grid.SetRow(garbageCollector.Image, garbageCollector.Coords.Y); - Grid.SetColumn(garbageCollector.Image, garbageCollector.Coords.X); - CollectorBoard.Children.Add(garbageCollector.Image); - CollectorBoard.ShowGridLines = true; + Canvas.SetLeft(garbageCollector.Image, garbageCollector.Coords.X * 100); + Canvas.SetTop(garbageCollector.Image, garbageCollector.Coords.Y * 100); + Board.Children.Add(garbageCollector.Image); //CollectorInfo.ItemsSource = garbageCollector; //CollectorInfo.Items.Add(garbageCollector); //CollectorInfo.Columns.Add(new DataGridTextColumn {Header="X", Binding = new Binding("Coords.X")}); @@ -138,8 +126,8 @@ namespace CzokoŚmieciarka.WPFv2 WPFHouse house = new WPFHouse(new Coords(1, 3), trashCans); Objects[1, 3] = house; - Grid.SetRow(Objects[1, 3].Image, 3); - Grid.SetColumn(Objects[1, 3].Image, 1); + Canvas.SetLeft(Objects[1, 3].Image, 1 * 100); + Canvas.SetTop(Objects[1, 3].Image, 3 * 100); Board.Children.Add(Objects[1, 3].Image); diff --git a/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/GarbageCollector.cs b/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/GarbageCollector.cs index 64e56d8..dce1412 100644 --- a/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/GarbageCollector.cs +++ b/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/GarbageCollector.cs @@ -33,7 +33,9 @@ namespace CzokoŚmieciarka.WPFv2.Models { Image = new Image() { - Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\garbageCollector.png")) + Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\garbageCollector.png")), + Width = 100, + Height = 100 }; } diff --git a/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/House.cs b/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/House.cs index eb7b999..b8aea36 100644 --- a/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/House.cs +++ b/Trunk/Interface/CzokoŚmieciarka.WPFv2/Models/House.cs @@ -30,7 +30,9 @@ namespace CzokoŚmieciarka.WPFv2.Models { Image = new Image() { - Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\house.png")) + Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\house.png")), + Width = 100, + Height = 100 }; TrashCans = trashCans; Coords = coords; diff --git a/Trunk/MonoGameView/Algorithms/DFS.cs b/Trunk/MonoGameView/Algorithms/DFS.cs new file mode 100644 index 0000000..10ae788 --- /dev/null +++ b/Trunk/MonoGameView/Algorithms/DFS.cs @@ -0,0 +1,217 @@ +<<<<<<< HEAD:Trunk/Components/CzokoŚmieciarka.AI_Naive/DFS.cs +using CzokoŚmieciarka.DataModels.Enums; +using CzokoŚmieciarka.DataModels.Interfaces; +using CzokoŚmieciarka.DataModels.Interfaces.GarbageCollector; +using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.DataModels.Models; +using CzokoŚmieciarka.DataModels.Models.Steps; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CzokoŚmieciarka.AI_Naive +{ + public class DFS + { + public DFS() + { + } + int count = 0; + + + public List BestPath(AGarbageCollector collector, object[,] grid) + { + var r=Search(collector, grid, 0).Key; + Console.WriteLine(count); + return r; + } + + List PossibleSteps(AGarbageCollector collector, object[,] grid) + { + + + var result = new List(); + var moveSteps = new List() + { + new MoveStep(Direction.Up), + new MoveStep(Direction.Down), + new MoveStep(Direction.Left), + new MoveStep(Direction.Right) + }; + var filteredMoveSteps = new List(); + foreach (var item in moveSteps) + { + var copyCollector = (AGarbageCollector)collector.Clone(); + var copyGrid = (object[,])grid.Clone(); + try + { + item.Invoke(copyCollector, grid); + var gcx = copyCollector.Coords.X; + var gcy = copyCollector.Coords.Y; + if (grid[gcx, gcy] is IRoad1 || grid[gcx, gcy] is IGarbageLocalization || grid[gcx, gcy] is ADump) + { + result.Add(item); + } + } + catch (Exception e) + { + + } + } + + return result; + } + + KeyValuePair, int> Search(AGarbageCollector collector, object[,] grid, int length) + { + count++; + if (length > 40) return new KeyValuePair, int>(new List(), length); + var possibleSteps = PossibleSteps(collector, grid); + + foreach (var item in possibleSteps) + { + var copyCollector = (AGarbageCollector)collector.Clone(); + var copyGrid = (object[,])grid.Clone(); + + + + + + + + //if (copyGrid[copyCollector.Coords.X, copyCollector.Coords.Y] is IRoad1) copyGrid[copyCollector.Coords.X, copyCollector.Coords.Y] = new Road2(); + item.Invoke(copyCollector, copyGrid); + var s = Search(copyCollector, copyGrid, length + 1); + if (s.Key != null) + { + s.Key.Insert(0, item); + return s; + } + } + return new KeyValuePair, int>(null, length); + /*var min = int.MaxValue; + var min_index = 0; + for (int i = 0; i < mapped.Count; i++) + { + if (mapped.ElementAt(i).Value <= min) + { + min = mapped.ElementAt(i).Value; + min_index = i; + } + } + return mapped.ElementAt(min_index); + */ + + + } + } +} +======= +using CzokoŚmieciarka.MonoGameView.DataModels.Enums; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Models; +using CzokoŚmieciarka.MonoGameView.DataModels.Models.Steps; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework.Content; + +namespace CzokoŚmieciarka.MonoGameView.Algorithms +{ + public class DFS + { + public DFS() + { + } + int count = 0; + + + public List BestPath(ContentManager content, AGarbageCollector collector, object[,] grid) + { + var r=Search(content, collector, grid, 0).Key; + Console.WriteLine(count); + return r; + } + + List PossibleSteps(ContentManager content, AGarbageCollector collector, object[,] grid) + { + + + var result = new List(); + var moveSteps = new List() + { + new MoveStep(Direction.Up), + new MoveStep(Direction.Down), + new MoveStep(Direction.Left), + new MoveStep(Direction.Right) + }; + var filteredMoveSteps = new List(); + foreach (var item in moveSteps) + { + var copyCollector = (AGarbageCollector)collector.Clone(content); + var copyGrid = (object[,])grid.Clone(); + try + { + item.Invoke(copyCollector, grid); + var gcx = copyCollector.Coords.X; + var gcy = copyCollector.Coords.Y; + if (grid[gcx, gcy] is IRoad1 || grid[gcx, gcy] is IGarbageLocalization || grid[gcx, gcy] is ADump) + { + result.Add(item); + } + } + catch (Exception e) + { + + } + } + + return result; + } + + KeyValuePair, int> Search(ContentManager content, AGarbageCollector collector, object[,] grid, int length) + { + count++; + if (length > 40) return new KeyValuePair, int>(new List(), length); + var possibleSteps = PossibleSteps(content, collector, grid); + + foreach (var item in possibleSteps) + { + var copyCollector = (AGarbageCollector)collector.Clone(content); + var copyGrid = (object[,])grid.Clone(); + + + //if (copyGrid[copyCollector.Coords.X, copyCollector.Coords.Y] is IRoad1) copyGrid[copyCollector.Coords.X, copyCollector.Coords.Y] = new Road2(); + item.Invoke(copyCollector, copyGrid); + var s = Search(content, copyCollector, copyGrid, length + 1); + if (s.Key != null) + { + s.Key.Insert(0, item); + return s; + } + } + return new KeyValuePair, int>(null, length); + /*var min = int.MaxValue; + var min_index = 0; + for (int i = 0; i < mapped.Count; i++) + { + if (mapped.ElementAt(i).Value <= min) + { + min = mapped.ElementAt(i).Value; + min_index = i; + } + } + return mapped.ElementAt(min_index); + */ + + + } + } +} +>>>>>>> c3875873aa1c65d56eefe5ebef2127852fe69b7a:Trunk/MonoGameView/Algorithms/DFS.cs diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Enums/Directions.cs b/Trunk/MonoGameView/DataModels/Enums/Directions.cs similarity index 61% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Enums/Directions.cs rename to Trunk/MonoGameView/DataModels/Enums/Directions.cs index 1c46e50..aff1717 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Enums/Directions.cs +++ b/Trunk/MonoGameView/DataModels/Enums/Directions.cs @@ -1,4 +1,4 @@ -namespace CzokoŚmieciarka.DataModels.Enums +namespace CzokoŚmieciarka.MonoGameView.DataModels.Enums { public enum Direction { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Enums/GarbageTypes.cs b/Trunk/MonoGameView/DataModels/Enums/GarbageTypes.cs similarity index 80% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Enums/GarbageTypes.cs rename to Trunk/MonoGameView/DataModels/Enums/GarbageTypes.cs index ce58a4a..755bb93 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Enums/GarbageTypes.cs +++ b/Trunk/MonoGameView/DataModels/Enums/GarbageTypes.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace CzokoŚmieciarka.DataModels.Enums +namespace CzokoŚmieciarka.MonoGameView.DataModels.Enums { public enum GarbageType { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Exceptions.cs b/Trunk/MonoGameView/DataModels/Exceptions/Exceptions.cs similarity index 63% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Exceptions.cs rename to Trunk/MonoGameView/DataModels/Exceptions/Exceptions.cs index fb15cd3..52ec2f5 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Exceptions.cs +++ b/Trunk/MonoGameView/DataModels/Exceptions/Exceptions.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace CzokoŚmieciarka.DataModels +namespace CzokoŚmieciarka.MonoGameView.DataModels.Exceptions { public class WrongPositionException : Exception { @@ -26,4 +26,20 @@ namespace CzokoŚmieciarka.DataModels } } + public class OutOfGridException : Exception + { + public OutOfGridException() + { + } + public OutOfGridException(string message) + : base(message) + { + } + + public OutOfGridException(string message, Exception inner) + : base(message, inner) + { + } + } + } diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Garbage/AGarbage.cs b/Trunk/MonoGameView/DataModels/Interfaces/Garbage/AGarbage.cs similarity index 93% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Garbage/AGarbage.cs rename to Trunk/MonoGameView/DataModels/Interfaces/Garbage/AGarbage.cs index 1ae2f2a..3c71b29 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Garbage/AGarbage.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/Garbage/AGarbage.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace CzokoŚmieciarka.DataModels.Interfaces +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.Garbage { public abstract class AGarbage : IGarbage { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Garbage/IGarbage.cs b/Trunk/MonoGameView/DataModels/Interfaces/Garbage/IGarbage.cs similarity index 79% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Garbage/IGarbage.cs rename to Trunk/MonoGameView/DataModels/Interfaces/Garbage/IGarbage.cs index f76aef2..097f8b7 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Garbage/IGarbage.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/Garbage/IGarbage.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace CzokoŚmieciarka.DataModels.Interfaces +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.Garbage { public interface IGarbage : ICloneable { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/GarbageCollector/AGarbageCollector.cs b/Trunk/MonoGameView/DataModels/Interfaces/GarbageCollector/AGarbageCollector.cs similarity index 77% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/GarbageCollector/AGarbageCollector.cs rename to Trunk/MonoGameView/DataModels/Interfaces/GarbageCollector/AGarbageCollector.cs index c071ed9..4c0d953 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/GarbageCollector/AGarbageCollector.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/GarbageCollector/AGarbageCollector.cs @@ -1,67 +1,72 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using CzokoŚmieciarka.DataModels.Exceptions; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; -using CzokoŚmieciarka.DataModels.Models; - -namespace CzokoŚmieciarka.DataModels.Interfaces.GarbageCollector -{ - public abstract class AGarbageCollector : IGarbageCollector, ICloneable - { - public AGarbageCollector(Coords startPosition, IEnumerable trashContainers, int columns, int rows) - { - this.columns = columns; - this.rows = rows; - this.Coords = startPosition; - this.TrashContainers = trashContainers; - } - public Coords Coords { get; set; } - public int columns { get; set; } - public int rows { get; set; } - public void MoveUp() - { - if(Coords.Y -1 < 0) - { - throw new OutOfGridException(); - } - Coords.Y -= 1; - } - - public void MoveDown() - { - if (Coords.Y + 1 >= rows) - { - throw new OutOfGridException(); - } - Coords.Y +=1; - } - - public void MoveLeft() - { - if (Coords.X - 1 < 0) - { - throw new OutOfGridException(); - } - Coords.X -= 1; - } - - public void MoveRight() - { - if (Coords.X + 1 >= columns) - { - throw new OutOfGridException(); - } - Coords.X += 1; - } - - public virtual object Clone() - { - throw new NotImplementedException(); - } - - public IEnumerable TrashContainers { get; } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CzokoŚmieciarka.MonoGameView.DataModels.Exceptions; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Models; +using Microsoft.Xna.Framework.Content; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector +{ + public abstract class AGarbageCollector : IGarbageCollector, ICloneable + { + public AGarbageCollector(Coords startPosition, IEnumerable trashContainers, int columns, int rows) + { + this.columns = columns; + this.rows = rows; + this.Coords = startPosition; + this.TrashContainers = trashContainers; + } + public Coords Coords { get; set; } + public int columns { get; set; } + public int rows { get; set; } + public void MoveUp() + { + if(Coords.Y -1 < 0) + { + throw new OutOfGridException(); + } + Coords.Y -= 1; + } + + public void MoveDown() + { + if (Coords.Y + 1 >= rows) + { + throw new OutOfGridException(); + } + Coords.Y +=1; + } + + public void MoveLeft() + { + if (Coords.X - 1 < 0) + { + throw new OutOfGridException(); + } + Coords.X -= 1; + } + + public void MoveRight() + { + if (Coords.X + 1 >= columns) + { + throw new OutOfGridException(); + } + Coords.X += 1; + } + + public virtual object Clone(ContentManager content) + { + throw new NotImplementedException(); + } + + public IEnumerable TrashContainers { get; } + public object Clone() + { + throw new NotImplementedException(); + } + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/GarbageCollector/IGarbageCollector.cs b/Trunk/MonoGameView/DataModels/Interfaces/GarbageCollector/IGarbageCollector.cs similarity index 65% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/GarbageCollector/IGarbageCollector.cs rename to Trunk/MonoGameView/DataModels/Interfaces/GarbageCollector/IGarbageCollector.cs index 89bc30e..c705805 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/GarbageCollector/IGarbageCollector.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/GarbageCollector/IGarbageCollector.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; -using CzokoŚmieciarka.DataModels.Models; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Models; -namespace CzokoŚmieciarka.DataModels.Interfaces +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector { public interface IGarbageCollector : ICloneable { diff --git a/Trunk/MonoGameView/DataModels/Interfaces/IDrawables.cs b/Trunk/MonoGameView/DataModels/Interfaces/IDrawables.cs new file mode 100644 index 0000000..b212af0 --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Interfaces/IDrawables.cs @@ -0,0 +1,10 @@ +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces +{ + public interface IDrawables + { + void Draw(ContentManager content, SpriteBatch spriteBatch, int size); + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IGarbageLocalization.cs b/Trunk/MonoGameView/DataModels/Interfaces/IGarbageLocalization.cs similarity index 58% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IGarbageLocalization.cs rename to Trunk/MonoGameView/DataModels/Interfaces/IGarbageLocalization.cs index 55435a7..08c4fcd 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IGarbageLocalization.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/IGarbageLocalization.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; -using CzokoŚmieciarka.DataModels.Models; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Models; -namespace CzokoŚmieciarka.DataModels.Interfaces +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces { public interface IGarbageLocalization { diff --git a/Trunk/MonoGameView/DataModels/Interfaces/IHouse.cs b/Trunk/MonoGameView/DataModels/Interfaces/IHouse.cs new file mode 100644 index 0000000..d03aa40 --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Interfaces/IHouse.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces +{ + public interface IHouse + { + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IRoad.cs b/Trunk/MonoGameView/DataModels/Interfaces/IRoad.cs similarity index 72% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IRoad.cs rename to Trunk/MonoGameView/DataModels/Interfaces/IRoad.cs index 43c9b37..5c03df8 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IRoad.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/IRoad.cs @@ -1,12 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CzokoŚmieciarka.DataModels.Interfaces -{ - public interface IRoad - { - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces +{ + public interface IRoad + { + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IRoad1.cs b/Trunk/MonoGameView/DataModels/Interfaces/IRoad1.cs similarity index 72% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IRoad1.cs rename to Trunk/MonoGameView/DataModels/Interfaces/IRoad1.cs index a31b73c..9c8382f 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IRoad1.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/IRoad1.cs @@ -1,12 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CzokoŚmieciarka.DataModels.Interfaces -{ - public interface IRoad1 - { - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces +{ + public interface IRoad1 + { + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IRoad2.cs b/Trunk/MonoGameView/DataModels/Interfaces/IRoad2.cs similarity index 72% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IRoad2.cs rename to Trunk/MonoGameView/DataModels/Interfaces/IRoad2.cs index ee9254e..e962c74 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/IRoad2.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/IRoad2.cs @@ -1,12 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CzokoŚmieciarka.DataModels.Interfaces -{ - public interface IRoad2 - { - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces +{ + public interface IRoad2 + { + } +} diff --git a/Trunk/MonoGameView/DataModels/Interfaces/IStep.cs b/Trunk/MonoGameView/DataModels/Interfaces/IStep.cs new file mode 100644 index 0000000..f526bec --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Interfaces/IStep.cs @@ -0,0 +1,9 @@ +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces +{ + public interface IStep + { + void Invoke(IGarbageCollector collector, object [,] grid); + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/ITypeOfGarbage.cs b/Trunk/MonoGameView/DataModels/Interfaces/ITypeOfGarbage.cs similarity index 71% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/ITypeOfGarbage.cs rename to Trunk/MonoGameView/DataModels/Interfaces/ITypeOfGarbage.cs index b8b65c0..f7e6e85 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/ITypeOfGarbage.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/ITypeOfGarbage.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using CzokoŚmieciarka.DataModels.Enums; +using CzokoŚmieciarka.MonoGameView.DataModels.Enums; -namespace CzokoŚmieciarka.DataModels.Interfaces +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces { public interface ITypeOfGarbage { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/RoutePlanningEngine/IRoutePlanningEngine.cs b/Trunk/MonoGameView/DataModels/Interfaces/RoutePlanningEngine/IRoutePlanningEngine.cs similarity index 58% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/RoutePlanningEngine/IRoutePlanningEngine.cs rename to Trunk/MonoGameView/DataModels/Interfaces/RoutePlanningEngine/IRoutePlanningEngine.cs index f20ed55..23defd3 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/RoutePlanningEngine/IRoutePlanningEngine.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/RoutePlanningEngine/IRoutePlanningEngine.cs @@ -3,9 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; -namespace CzokoŚmieciarka.DataModels.Interfaces.RoutePlanningEngine +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.RoutePlanningEngine { public interface IRoutePlanningEngine { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/TrashCans/ADump.cs b/Trunk/MonoGameView/DataModels/Interfaces/TrashCans/ADump.cs similarity index 69% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/TrashCans/ADump.cs rename to Trunk/MonoGameView/DataModels/Interfaces/TrashCans/ADump.cs index d59ce30..59094fd 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/TrashCans/ADump.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/TrashCans/ADump.cs @@ -1,6 +1,6 @@ -using CzokoŚmieciarka.DataModels.Models; +using CzokoŚmieciarka.MonoGameView.DataModels.Models; -namespace CzokoŚmieciarka.DataModels.Interfaces.TrashCans +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans { public abstract class ADump : ATrashCan { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/TrashCans/AGarbageCollectorContainer.cs b/Trunk/MonoGameView/DataModels/Interfaces/TrashCans/AGarbageCollectorContainer.cs similarity index 75% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/TrashCans/AGarbageCollectorContainer.cs rename to Trunk/MonoGameView/DataModels/Interfaces/TrashCans/AGarbageCollectorContainer.cs index 6c49db5..de7a40c 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/TrashCans/AGarbageCollectorContainer.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/TrashCans/AGarbageCollectorContainer.cs @@ -1,4 +1,4 @@ -namespace CzokoŚmieciarka.DataModels.Interfaces.TrashCans +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans { public abstract class AGarbageCollectorContainer : ATrashCan { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/TrashCans/ATrashCan.cs b/Trunk/MonoGameView/DataModels/Interfaces/TrashCans/ATrashCan.cs similarity index 90% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/TrashCans/ATrashCan.cs rename to Trunk/MonoGameView/DataModels/Interfaces/TrashCans/ATrashCan.cs index 9d900cf..5df8a4b 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/TrashCans/ATrashCan.cs +++ b/Trunk/MonoGameView/DataModels/Interfaces/TrashCans/ATrashCan.cs @@ -1,6 +1,7 @@ using System; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.Garbage; -namespace CzokoŚmieciarka.DataModels.Interfaces.TrashCans +namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans { public abstract class ATrashCan { diff --git a/Trunk/MonoGameView/DataModels/MapLoader.cs b/Trunk/MonoGameView/DataModels/MapLoader.cs new file mode 100644 index 0000000..77c61eb --- /dev/null +++ b/Trunk/MonoGameView/DataModels/MapLoader.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml; +using CzokoŚmieciarka.MonoGameView.DataModels.GeneralModels.Models; +using CzokoŚmieciarka.MonoGameView.DataModels.Models; +using MonoGameView.DataModels.Models; + +namespace MonoGameView.DataModels +{ + public class MapLoader + { + public void Load(out int size, out object[,] grid, string filename) + { + XmlDocument xml = new XmlDocument(); + xml.Load(filename); + XmlNode node = xml.GetElementsByTagName("Map").Item(0); + XmlNode sizeNode = node.SelectSingleNode("/Map/Size"); + size = Convert.ToInt32(sizeNode.InnerText); + grid = new object[size,size]; + for (int x = 0; x < size; x++) + { + for (int y = 0; y < size; y++) + { + grid[x, y] = new Grass(new Coords(x,y)); + } + } + foreach(XmlNode objectNode in node.SelectNodes("/Map/Objects/Object")) + { + XmlNode positionNode; + int x; + int y; + switch (objectNode.SelectSingleNode("Type").InnerText) + { + case "Road": + positionNode = objectNode.SelectSingleNode("Position"); + x = Convert.ToInt32(positionNode.SelectSingleNode("X").InnerText); + y = Convert.ToInt32(positionNode.SelectSingleNode("Y").InnerText); + Road1 road = new Road1(new Coords(x,y)); + grid[x, y] = road; + break; + case "House": + positionNode = objectNode.SelectSingleNode("Position"); + x = Convert.ToInt32(positionNode.SelectSingleNode("X").InnerText); + y = Convert.ToInt32(positionNode.SelectSingleNode("Y").InnerText); + House house = new House(new Coords(x,y)); + grid[x, y] = house; + break; + } + } + } + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Coords.cs b/Trunk/MonoGameView/DataModels/Models/Coords.cs similarity index 94% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Models/Coords.cs rename to Trunk/MonoGameView/DataModels/Models/Coords.cs index b6d9c21..8d27913 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Coords.cs +++ b/Trunk/MonoGameView/DataModels/Models/Coords.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace CzokoŚmieciarka.DataModels.Models +namespace CzokoŚmieciarka.MonoGameView.DataModels.Models { public class Coords { @@ -34,21 +34,21 @@ namespace CzokoŚmieciarka.DataModels.Models public static Coords operator -(Coords a, Coords b) { return new Coords(a.X - b.X, a.Y - b.Y); - } - - public override string ToString() - { - return base.ToString(); - } - - public override bool Equals(object obj) - { - return base.Equals(obj); - } - - public override int GetHashCode() - { - return base.GetHashCode(); - } + } + + public override string ToString() + { + return base.ToString(); + } + + public override bool Equals(object obj) + { + return base.Equals(obj); + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } } } diff --git a/Trunk/MonoGameView/DataModels/Models/Dump.cs b/Trunk/MonoGameView/DataModels/Models/Dump.cs new file mode 100644 index 0000000..2de111e --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Models/Dump.cs @@ -0,0 +1,13 @@ +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Models; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.GeneralModels.Models +{ + public class Dump : ADump + { + public Dump(ITypeOfGarbage typeOfGarbage, int maxVolume, Coords localization) : base(typeOfGarbage, maxVolume, localization) + { + } + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/Garbage.cs b/Trunk/MonoGameView/DataModels/Models/Garbage.cs similarity index 70% rename from Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/Garbage.cs rename to Trunk/MonoGameView/DataModels/Models/Garbage.cs index 059e9f7..165d1a2 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/Garbage.cs +++ b/Trunk/MonoGameView/DataModels/Models/Garbage.cs @@ -1,7 +1,8 @@ using System; -using CzokoŚmieciarka.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.Garbage; -namespace CzokoŚmieciarka.DataModels.GeneralModels.Models +namespace CzokoŚmieciarka.MonoGameView.DataModels.GeneralModels.Models { public class Garbage : AGarbage { diff --git a/Trunk/MonoGameView/DataModels/Models/GarbageCollector.cs b/Trunk/MonoGameView/DataModels/Models/GarbageCollector.cs new file mode 100644 index 0000000..206cf26 --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Models/GarbageCollector.cs @@ -0,0 +1,33 @@ +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Models +{ + public class GarbageCollector : AGarbageCollector, IDrawables + { + public GarbageCollector(Coords c, List l, int rows, int cols) : base(c,l,rows,cols) + { + } + + public void Draw(ContentManager content, SpriteBatch batch,int size) + { + batch.Draw(content.Load("collector"), new Rectangle(Coords.X*500/size, Coords.Y*500/size, 500/size, 500/size), Color.White); + } + + + public override object Clone(ContentManager content) + { + var cloneList = new List(); + return new GarbageCollector(new Coords(Coords.X,Coords.Y), cloneList, rows,columns); + } + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/GarbageCollectorContainer.cs b/Trunk/MonoGameView/DataModels/Models/GarbageCollectorContainer.cs similarity index 52% rename from Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/GarbageCollectorContainer.cs rename to Trunk/MonoGameView/DataModels/Models/GarbageCollectorContainer.cs index 9b095ea..7f0fbc3 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/GarbageCollectorContainer.cs +++ b/Trunk/MonoGameView/DataModels/Models/GarbageCollectorContainer.cs @@ -1,7 +1,7 @@ -using CzokoŚmieciarka.DataModels.Interfaces; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; -namespace CzokoŚmieciarka.DataModels.GeneralModels.Models +namespace CzokoŚmieciarka.MonoGameView.DataModels.GeneralModels.Models { public class GarbageCollectorContainer : AGarbageCollectorContainer { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/GarbageLocalization.cs b/Trunk/MonoGameView/DataModels/Models/GarbageLocalization.cs similarity index 65% rename from Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/GarbageLocalization.cs rename to Trunk/MonoGameView/DataModels/Models/GarbageLocalization.cs index 29f38a8..ca22d01 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/GarbageLocalization.cs +++ b/Trunk/MonoGameView/DataModels/Models/GarbageLocalization.cs @@ -3,11 +3,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using CzokoŚmieciarka.DataModels.Interfaces; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; -using CzokoŚmieciarka.DataModels.Models; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Models; -namespace CzokoŚmieciarka.DataModels.GeneralModels.Models +namespace CzokoŚmieciarka.MonoGameView.DataModels.GeneralModels.Models { public class GarbageLocalization : IGarbageLocalization { diff --git a/Trunk/MonoGameView/DataModels/Models/Grass.cs b/Trunk/MonoGameView/DataModels/Models/Grass.cs new file mode 100644 index 0000000..d450ab9 --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Models/Grass.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Models; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; + +namespace MonoGameView.DataModels.Models +{ + public class Grass : IDrawables + { + private Coords Coords; + + public Grass(Coords coords) + { + Coords = coords; + } + + public void Draw(ContentManager content, SpriteBatch batch, int size) + { + batch.Draw(content.Load("grass"), new Rectangle(Coords.X * 500 / size, Coords.Y * 500 / size, 500 / size, 500 / size), Color.White); + } + } +} diff --git a/Trunk/MonoGameView/DataModels/Models/House.cs b/Trunk/MonoGameView/DataModels/Models/House.cs new file mode 100644 index 0000000..66fe936 --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Models/House.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Models +{ + public class House : IDrawables + { + private Coords Coords; + + public House(Coords coords) + { + Coords = coords; + } + public void Draw(ContentManager content, SpriteBatch batch, int size) + { + batch.Draw(content.Load("house"), new Rectangle(Coords.X * 500 / size, Coords.Y * 500 / size, 500 / size, 500 / size), Color.White); + } + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Map.cs b/Trunk/MonoGameView/DataModels/Models/Map.cs similarity index 77% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Models/Map.cs rename to Trunk/MonoGameView/DataModels/Models/Map.cs index 3cd1057..b117992 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Map.cs +++ b/Trunk/MonoGameView/DataModels/Models/Map.cs @@ -4,9 +4,10 @@ using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; -using CzokoŚmieciarka.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using Microsoft.Xna.Framework; -namespace CzokoŚmieciarka.DataModels.Models +namespace CzokoŚmieciarka.MonoGameView.DataModels.Models { public class Map { diff --git a/Trunk/MonoGameView/DataModels/Models/Road1.cs b/Trunk/MonoGameView/DataModels/Models/Road1.cs new file mode 100644 index 0000000..399dbec --- /dev/null +++ b/Trunk/MonoGameView/DataModels/Models/Road1.cs @@ -0,0 +1,27 @@ +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Content; +using Microsoft.Xna.Framework.Graphics; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Models +{ + public class Road1 :IRoad1 + { + private Coords Coords; + + public Road1(Coords coords) + { + Coords = coords; + } + + public void Draw(ContentManager content, SpriteBatch batch, int size) + { + batch.Draw(content.Load("grass"), new Rectangle(Coords.X * 500 / size, Coords.Y * 500 / size, 500 / size, 500 / size), Color.White); + } + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Road2.cs b/Trunk/MonoGameView/DataModels/Models/Road2.cs similarity index 57% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Models/Road2.cs rename to Trunk/MonoGameView/DataModels/Models/Road2.cs index e9a4093..1838d6b 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Road2.cs +++ b/Trunk/MonoGameView/DataModels/Models/Road2.cs @@ -1,13 +1,13 @@ -using CzokoŚmieciarka.DataModels.Interfaces; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CzokoŚmieciarka.DataModels.Models -{ - public class Road2 : IRoad2 - { - } -} +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CzokoŚmieciarka.MonoGameView.DataModels.Models +{ + public class Road2 : IRoad2 + { + } +} diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Steps/CollectStep.cs b/Trunk/MonoGameView/DataModels/Models/Steps/CollectStep.cs similarity index 81% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Models/Steps/CollectStep.cs rename to Trunk/MonoGameView/DataModels/Models/Steps/CollectStep.cs index 8c2d369..75ebfe7 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Steps/CollectStep.cs +++ b/Trunk/MonoGameView/DataModels/Models/Steps/CollectStep.cs @@ -3,10 +3,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using CzokoŚmieciarka.DataModels.Interfaces; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; -namespace CzokoŚmieciarka.DataModels.Models.Steps +namespace CzokoŚmieciarka.MonoGameView.DataModels.Models.Steps { public class CollectStep : IStep { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Steps/MoveStep.cs b/Trunk/MonoGameView/DataModels/Models/Steps/MoveStep.cs similarity index 75% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Models/Steps/MoveStep.cs rename to Trunk/MonoGameView/DataModels/Models/Steps/MoveStep.cs index ba757ba..6f377fa 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Steps/MoveStep.cs +++ b/Trunk/MonoGameView/DataModels/Models/Steps/MoveStep.cs @@ -3,11 +3,12 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using CzokoŚmieciarka.DataModels.Enums; -using CzokoŚmieciarka.DataModels.Interfaces; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Enums; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; -namespace CzokoŚmieciarka.DataModels.Models.Steps +namespace CzokoŚmieciarka.MonoGameView.DataModels.Models.Steps { public class MoveStep : IStep { @@ -21,7 +22,7 @@ namespace CzokoŚmieciarka.DataModels.Models.Steps public void Invoke(IGarbageCollector _garbageCollector, object[,] grid) { - if(grid[_garbageCollector.Coords.X, _garbageCollector.Coords.Y] is Road1) + if(grid[_garbageCollector.Coords.X, _garbageCollector.Coords.Y] is Road1) grid[_garbageCollector.Coords.X, _garbageCollector.Coords.Y] = new Road2(); switch (_direction) { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Steps/SpillStep.cs b/Trunk/MonoGameView/DataModels/Models/Steps/SpillStep.cs similarity index 82% rename from Trunk/Components/CzokoŚmieciarka.DataModels/Models/Steps/SpillStep.cs rename to Trunk/MonoGameView/DataModels/Models/Steps/SpillStep.cs index e898bf3..d259717 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels/Models/Steps/SpillStep.cs +++ b/Trunk/MonoGameView/DataModels/Models/Steps/SpillStep.cs @@ -3,10 +3,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using CzokoŚmieciarka.DataModels.Interfaces; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; -namespace CzokoŚmieciarka.DataModels.Models.Steps +namespace CzokoŚmieciarka.MonoGameView.DataModels.Models.Steps { public class SpillStep : IStep { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/TrashCan.cs b/Trunk/MonoGameView/DataModels/Models/TrashCan.cs similarity index 61% rename from Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/TrashCan.cs rename to Trunk/MonoGameView/DataModels/Models/TrashCan.cs index c42c7ef..74a0637 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/TrashCan.cs +++ b/Trunk/MonoGameView/DataModels/Models/TrashCan.cs @@ -1,7 +1,7 @@ -using CzokoŚmieciarka.DataModels.Interfaces; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; -namespace CzokoŚmieciarka.DataModels.GeneralModels.Models +namespace CzokoŚmieciarka.MonoGameView.DataModels.GeneralModels.Models { public class TrashCan : ATrashCan { diff --git a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/TypeOfGarbage.cs b/Trunk/MonoGameView/DataModels/Models/TypeOfGarbage.cs similarity index 71% rename from Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/TypeOfGarbage.cs rename to Trunk/MonoGameView/DataModels/Models/TypeOfGarbage.cs index 38f6415..c942553 100644 --- a/Trunk/Components/CzokoŚmieciarka.DataModels.GeneralModels/Models/TypeOfGarbage.cs +++ b/Trunk/MonoGameView/DataModels/Models/TypeOfGarbage.cs @@ -1,7 +1,7 @@ -using CzokoŚmieciarka.DataModels.Enums; -using CzokoŚmieciarka.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Enums; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; -namespace CzokoŚmieciarka.DataModels.GeneralModels.Models +namespace CzokoŚmieciarka.MonoGameView.DataModels.GeneralModels.Models { public class TypeOfGarbage : ITypeOfGarbage { diff --git a/Trunk/MonoGameView/Game1.cs b/Trunk/MonoGameView/Game1.cs index 41c531a..3787078 100644 --- a/Trunk/MonoGameView/Game1.cs +++ b/Trunk/MonoGameView/Game1.cs @@ -1,15 +1,15 @@ -using CzokoŚmieciarka.AI_Naive; -using CzokoŚmieciarka.DataModels.Interfaces; -using CzokoŚmieciarka.DataModels.Interfaces.GarbageCollector; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; -using CzokoŚmieciarka.DataModels.Models; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector; +using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans; +using CzokoŚmieciarka.MonoGameView.DataModels.Models; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; -using MonoGameView; using System; using System.Collections.Generic; using System.Linq; +using CzokoŚmieciarka.MonoGameView.Algorithms; +using MonoGameView.DataModels; namespace CzokoŚmieciarka.MonoGameView { @@ -18,18 +18,21 @@ namespace CzokoŚmieciarka.MonoGameView /// public class Game1 : Game { + private static int size; GraphicsDeviceManager graphics; SpriteBatch spriteBatch; Texture2D road1; Texture2D road2; Texture2D grass; + Texture2D house; + MapLoader mapLoader = new MapLoader(); Vector2 roadPos; float timer; const float TIMER = 0.2f; int stepN; List steps; GarbageCollector collector; - object[,] grid = new object[10, 10]; + object[,] grid; public Game1() { graphics = new GraphicsDeviceManager(this); @@ -50,6 +53,7 @@ namespace CzokoŚmieciarka.MonoGameView { // TODO: Add your initialization logic here roadPos = new Vector2(0, 0); +<<<<<<< HEAD timer = 5f; for (int x=0;x<10;x++) { @@ -59,14 +63,17 @@ namespace CzokoŚmieciarka.MonoGameView else grid[x, y] = null; } } +======= + timer = 0.2f; +>>>>>>> c3875873aa1c65d56eefe5ebef2127852fe69b7a - - collector = new GarbageCollector(Content,new Coords(0, 0), new List(), 10, 10); + mapLoader.Load(out size,out grid,"map.xml"); + collector = new GarbageCollector(new Coords(0, 0), new List(), size, size); stepN = 0; var dfs = new DFS(); - steps = dfs.BestPath(collector, grid); + steps = dfs.BestPath(Content, collector, grid); base.Initialize(); } @@ -82,6 +89,7 @@ namespace CzokoŚmieciarka.MonoGameView road1 = Content.Load("road1"); road2 = Content.Load("road2"); grass = Content.Load("grass"); + house = Content.Load("house"); // TODO: use this.Content to load your game content here } @@ -91,6 +99,7 @@ namespace CzokoŚmieciarka.MonoGameView /// protected override void UnloadContent() { + Content.Unload(); // TODO: Unload any non ContentManager content here } @@ -115,11 +124,6 @@ namespace CzokoŚmieciarka.MonoGameView } } // TODO: Add your update logic here - - - - - base.Update(gameTime); } @@ -133,16 +137,17 @@ namespace CzokoŚmieciarka.MonoGameView GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); - for (int x = 0; x < 10; x++) + for (int x = 0; x < size; x++) { - for (int y = 0; y < 10; y++) + for (int y = 0; y < size; y++) { - if (grid[x, y] is Road1) spriteBatch.Draw(road1, new Vector2(x*50,y*50), Color.White); - else if (grid[x,y] is Road2) spriteBatch.Draw(road2, new Vector2(x * 50, y * 50), Color.White); - else spriteBatch.Draw(grass, new Vector2(x * 50, y * 50), Color.White); + if (grid[x, y] is Road1) spriteBatch.Draw(road1, new Rectangle(x*500 / size, y*500 / size, 500/size, 500/size),Color.White); + else if (grid[x,y] is Road2) spriteBatch.Draw(road2, new Rectangle(x * 500 / size, y * 500 / size, 500 / size, 500 / size), Color.White); + else if (grid[x, y] is House) spriteBatch.Draw(house, new Rectangle(x * 500 / size, y * 500 / size, 500 / size, 500 / size), Color.White); + else spriteBatch.Draw(grass, new Rectangle(x * 500 / size, y * 500 / size, 500 / size, 500 / size), Color.White); } } - collector.Draw(spriteBatch); + collector.Draw(Content, spriteBatch, size); spriteBatch.End(); // TODO: Add your drawing code here diff --git a/Trunk/MonoGameView/GarbageCollector.cs b/Trunk/MonoGameView/GarbageCollector.cs deleted file mode 100644 index e2e11a2..0000000 --- a/Trunk/MonoGameView/GarbageCollector.cs +++ /dev/null @@ -1,40 +0,0 @@ -using CzokoŚmieciarka.DataModels.Interfaces.GarbageCollector; -using CzokoŚmieciarka.DataModels.Interfaces.TrashCans; -using CzokoŚmieciarka.DataModels.Models; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Content; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MonoGameView -{ - public class GarbageCollector : AGarbageCollector - { - public Texture2D Image { get; set; } - public GarbageCollector(ContentManager content, Coords c, List l, int rows, int cols) : base(c,l,rows,cols) - { - Image = content.Load("collector"); - } - public GarbageCollector(Texture2D image, Coords c, List l, int rows, int cols) : base(c, l, rows, cols) - { - Image = image; - } - - - public void Draw(SpriteBatch batch) - { - batch.Draw(Image, new Vector2(Coords.X*50, Coords.Y*50), Color.White); - } - - - public override object Clone() - { - var cloneList = new List(); - return new GarbageCollector(Image, new Coords(Coords.X,Coords.Y), cloneList, rows,columns); - } - } -} diff --git a/Trunk/MonoGameView/MonoGameView.csproj b/Trunk/MonoGameView/MonoGameView.csproj index 318153e..3c34106 100644 --- a/Trunk/MonoGameView/MonoGameView.csproj +++ b/Trunk/MonoGameView/MonoGameView.csproj @@ -42,8 +42,44 @@ app.manifest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -62,20 +98,7 @@ - - - {10e77bbe-55e1-483d-a456-0e94eac9b24a} - CzokoŚmieciarka.AI_Naive - - - {a3d5da96-69d7-463f-b1ee-6fc70716e3b2} - CzokoŚmieciarka.DataModels.GeneralModels - - - {f2e11fee-c5ac-47d2-ba9c-819909b6dff7} - CzokoŚmieciarka.DataModels - - +