xd
@ -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<IStep> BestPath(AGarbageCollector collector, object[,] grid)
|
||||
{
|
||||
var r=Search(collector, grid, 0).Key;
|
||||
Console.WriteLine(count);
|
||||
return r;
|
||||
}
|
||||
|
||||
List<IStep> PossibleSteps(AGarbageCollector collector, object[,] grid)
|
||||
{
|
||||
|
||||
|
||||
var result = new List<IStep>();
|
||||
var moveSteps = new List<IStep>()
|
||||
{
|
||||
new MoveStep(Direction.Up),
|
||||
new MoveStep(Direction.Down),
|
||||
new MoveStep(Direction.Left),
|
||||
new MoveStep(Direction.Right)
|
||||
};
|
||||
var filteredMoveSteps = new List<IStep>();
|
||||
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<List<IStep>, int> Search(AGarbageCollector collector, object[,] grid, int length)
|
||||
{
|
||||
count++;
|
||||
if (length > 40) return new KeyValuePair<List<IStep>, int>(new List<IStep>(), 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<List<IStep>, 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);
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -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<AGarbageCollectorContainer> trashContainers, int columns, int rows) : base(startPosition, trashContainers, columns, rows)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -42,32 +42,12 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Enums\GarbageTypes.cs" />
|
||||
<Compile Include="Exceptions.cs" />
|
||||
<Compile Include="Enums\Directions.cs" />
|
||||
<Compile Include="Exceptions\OutOfGridException.cs" />
|
||||
<Compile Include="Interfaces\GarbageCollector\AGarbageCollector.cs" />
|
||||
<Compile Include="Interfaces\GarbageCollector\IGarbageCollector.cs" />
|
||||
<Compile Include="Interfaces\Garbage\AGarbage.cs" />
|
||||
<Compile Include="Interfaces\Garbage\IGarbage.cs" />
|
||||
<Compile Include="Interfaces\IRoad.cs" />
|
||||
<Compile Include="Interfaces\IRoad1.cs" />
|
||||
<Compile Include="Interfaces\IRoad2.cs" />
|
||||
<Compile Include="Interfaces\TrashCans\ADump.cs" />
|
||||
<Compile Include="Interfaces\IGarbageLocalization.cs" />
|
||||
<Compile Include="Interfaces\ITypeOfGarbage.cs" />
|
||||
<Compile Include="Interfaces\RoutePlanningEngine\IRoutePlanningEngine.cs" />
|
||||
<Compile Include="Interfaces\TrashCans\AGarbageCollectorContainer.cs" />
|
||||
<Compile Include="Interfaces\TrashCans\ATrashCan.cs" />
|
||||
<Compile Include="Interfaces\IStep.cs" />
|
||||
<Compile Include="Models\Coords.cs" />
|
||||
<Compile Include="Models\Map.cs" />
|
||||
<Compile Include="Models\Road1.cs" />
|
||||
<Compile Include="Models\Road2.cs" />
|
||||
<Compile Include="Models\Steps\CollectStep.cs" />
|
||||
<Compile Include="Models\Steps\MoveStep.cs" />
|
||||
<Compile Include="Models\Steps\SpillStep.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Enums\" />
|
||||
<Folder Include="Interfaces\" />
|
||||
<Folder Include="Models\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
@ -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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
using CzokoŚmieciarka.DataModels.Interfaces.GarbageCollector;
|
||||
|
||||
namespace CzokoŚmieciarka.DataModels.Interfaces
|
||||
{
|
||||
public interface IStep
|
||||
{
|
||||
void Invoke(IGarbageCollector collector, object [,] grid);
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
||||
}
|
||||
}
|
@ -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
|
||||
|
118
Trunk/Interface/CzokoŚmieciarka.MonoGame/Content/Content.mgcb
Normal file
@ -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
|
||||
|
@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
This file contains an xml description of a font, and will be read by the XNA
|
||||
Framework Content Pipeline. Follow the comments to customize the appearance
|
||||
of the font in your game, and to change the characters which are available to draw
|
||||
with.
|
||||
-->
|
||||
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
|
||||
<Asset Type="Graphics:FontDescription">
|
||||
|
||||
<!--
|
||||
Modify this string to change the font that will be imported.
|
||||
-->
|
||||
<FontName>Arial</FontName>
|
||||
|
||||
<!--
|
||||
Size is a float value, measured in points. Modify this value to change
|
||||
the size of the font.
|
||||
-->
|
||||
<Size>12</Size>
|
||||
|
||||
<!--
|
||||
Spacing is a float value, measured in pixels. Modify this value to change
|
||||
the amount of spacing in between characters.
|
||||
-->
|
||||
<Spacing>0</Spacing>
|
||||
|
||||
<!--
|
||||
UseKerning controls the layout of the font. If this value is true, kerning information
|
||||
will be used when placing characters.
|
||||
-->
|
||||
<UseKerning>true</UseKerning>
|
||||
|
||||
<!--
|
||||
Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic",
|
||||
and "Bold, Italic", and are case sensitive.
|
||||
-->
|
||||
<Style>Regular</Style>
|
||||
|
||||
<!--
|
||||
If you uncomment this line, the default character will be substituted if you draw
|
||||
or measure text that contains characters which were not included in the font.
|
||||
-->
|
||||
<!-- <DefaultCharacter>*</DefaultCharacter> -->
|
||||
|
||||
<!--
|
||||
CharacterRegions control what letters are available in the font. Every
|
||||
character from Start to End will be built and made available for drawing. The
|
||||
default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin
|
||||
character set. The characters are ordered according to the Unicode standard.
|
||||
See the documentation for more information.
|
||||
-->
|
||||
<CharacterRegions>
|
||||
<CharacterRegion>
|
||||
<Start> </Start>
|
||||
<End>~</End>
|
||||
</CharacterRegion>
|
||||
</CharacterRegions>
|
||||
</Asset>
|
||||
</XnaContent>
|
After Width: | Height: | Size: 83 KiB |
After Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.0 KiB |
@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{3A27CBFB-44DF-4B1D-B776-770FCA3DF905}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CzokoŚmieciarka.MonoGame</RootNamespace>
|
||||
<AssemblyName>CzokoŚmieciarka.MonoGame</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MonoGamePlatform>Windows</MonoGamePlatform>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\</OutputPath>
|
||||
<DefineConstants>TRACE;WINDOWS</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>Icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Game1.cs" />
|
||||
<Compile Include="Interfaces\IWPFObject.cs" />
|
||||
<Compile Include="Models\Dump.cs" />
|
||||
<Compile Include="Models\GarbageCollector.cs" />
|
||||
<Compile Include="Models\House.cs" />
|
||||
<Compile Include="Models\Road.cs" />
|
||||
<Compile Include="Models\Road2.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="MonoGame.Framework">
|
||||
<HintPath>$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\Windows\MonoGame.Framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Icon.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<MonoGameContentReference Include="Content\Content.mgcb" />
|
||||
<None Include="app.manifest" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Components\CzokoŚmieciarka.AI_Naive\CzokoŚmieciarka.AI_Naive.csproj">
|
||||
<Project>{10e77bbe-55e1-483d-a456-0e94eac9b24a}</Project>
|
||||
<Name>CzokoŚmieciarka.AI_Naive</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Components\CzokoŚmieciarka.DataModels.GeneralModels\CzokoŚmieciarka.DataModels.GeneralModels.csproj">
|
||||
<Project>{a3d5da96-69d7-463f-b1ee-6fc70716e3b2}</Project>
|
||||
<Name>CzokoŚmieciarka.DataModels.GeneralModels</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Components\CzokoŚmieciarka.DataModels\CzokoŚmieciarka.DataModels.csproj">
|
||||
<Project>{f2e11fee-c5ac-47d2-ba9c-819909b6dff7}</Project>
|
||||
<Name>CzokoŚmieciarka.DataModels</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
94
Trunk/Interface/CzokoŚmieciarka.MonoGame/Game1.cs
Normal file
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// This is the main type for your game.
|
||||
/// </summary>
|
||||
public class Game1 : Game
|
||||
{
|
||||
GraphicsDeviceManager graphics;
|
||||
SpriteBatch spriteBatch;
|
||||
private Texture2D road;
|
||||
private IWPFObject[,] Objects = new IWPFObject[9, 9];
|
||||
private IEnumerable<AGarbageCollectorContainer> GarbageCollectorContainers;
|
||||
private WPFGarbageCollector garbageCollector;
|
||||
|
||||
public Game1()
|
||||
{
|
||||
graphics = new GraphicsDeviceManager(this);
|
||||
Content.RootDirectory = "Content";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
protected override void Initialize()
|
||||
{
|
||||
// TODO: Add your initialization logic here
|
||||
|
||||
base.Initialize();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// LoadContent will be called once per game and is the place to load
|
||||
/// all of your content.
|
||||
/// </summary>
|
||||
protected override void LoadContent()
|
||||
{
|
||||
// Create a new SpriteBatch, which can be used to draw textures.
|
||||
spriteBatch = new SpriteBatch(GraphicsDevice);
|
||||
road = Content.Load<Texture2D>("Images/intersection");
|
||||
// TODO: use this.Content to load your game content here
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// UnloadContent will be called once per game and is the place to unload
|
||||
/// game-specific content.
|
||||
/// </summary>
|
||||
protected override void UnloadContent()
|
||||
{
|
||||
// TODO: Unload any non ContentManager content here
|
||||
Content.Unload();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allows the game to run logic such as updating the world,
|
||||
/// checking for collisions, gathering input, and playing audio.
|
||||
/// </summary>
|
||||
/// <param name="gameTime">Provides a snapshot of timing values.</param>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is called when the game should draw itself.
|
||||
/// </summary>
|
||||
/// <param name="gameTime">Provides a snapshot of timing values.</param>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
BIN
Trunk/Interface/CzokoŚmieciarka.MonoGame/Icon.ico
Normal file
After Width: | Height: | Size: 144 KiB |
@ -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; }
|
||||
}
|
||||
}
|
38
Trunk/Interface/CzokoŚmieciarka.MonoGame/Models/Dump.cs
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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<AGarbageCollectorContainer> 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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
25
Trunk/Interface/CzokoŚmieciarka.MonoGame/Models/House.cs
Normal file
@ -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<ATrashCan> TrashCans { get; set; }
|
||||
|
||||
|
||||
public WPFHouse(Coords coords, IEnumerable<ATrashCan> trashCans)
|
||||
{
|
||||
TrashCans = trashCans;
|
||||
Coords = coords;
|
||||
}
|
||||
}
|
||||
}
|
41
Trunk/Interface/CzokoŚmieciarka.MonoGame/Models/Road.cs
Normal file
@ -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; }
|
||||
}
|
||||
}
|
20
Trunk/Interface/CzokoŚmieciarka.MonoGame/Models/Road2.cs
Normal file
@ -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()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
22
Trunk/Interface/CzokoŚmieciarka.MonoGame/Program.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
|
||||
namespace CzokoŚmieciarka.MonoGame
|
||||
{
|
||||
#if WINDOWS || LINUX
|
||||
/// <summary>
|
||||
/// The main class.
|
||||
/// </summary>
|
||||
public static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
using (var game = new Game1())
|
||||
game.Run();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
@ -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")]
|
42
Trunk/Interface/CzokoŚmieciarka.MonoGame/app.manifest
Normal file
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="CzokoŚmieciarka.MonoGame"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of the Windows versions that this application has been tested on and is
|
||||
is designed to work with. Uncomment the appropriate elements and Windows will
|
||||
automatically selected the most compatible environment. -->
|
||||
|
||||
<!-- Windows Vista -->
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />
|
||||
|
||||
<!-- Windows 7 -->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
|
||||
|
||||
<!-- Windows 8 -->
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
|
||||
|
||||
<!-- Windows 8.1 -->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
|
||||
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
|
||||
</assembly>
|
@ -102,20 +102,6 @@
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Components\CzokoŚmieciarka.AI_Naive\CzokoŚmieciarka.AI_Naive.csproj">
|
||||
<Project>{10e77bbe-55e1-483d-a456-0e94eac9b24a}</Project>
|
||||
<Name>CzokoŚmieciarka.AI_Naive</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Components\CzokoŚmieciarka.DataModels.GeneralModels\CzokoŚmieciarka.DataModels.GeneralModels.csproj">
|
||||
<Project>{a3d5da96-69d7-463f-b1ee-6fc70716e3b2}</Project>
|
||||
<Name>CzokoŚmieciarka.DataModels.GeneralModels</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Components\CzokoŚmieciarka.DataModels\CzokoŚmieciarka.DataModels.csproj">
|
||||
<Project>{f2e11fee-c5ac-47d2-ba9c-819909b6dff7}</Project>
|
||||
<Name>CzokoŚmieciarka.DataModels</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
@ -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">
|
||||
<Grid>
|
||||
<Grid Name="Board" Margin="0,0,200,0"/>
|
||||
<DataGrid Name="CollectorInfo" HorizontalAlignment="Right" Width="192"/>
|
||||
<Grid Name="CollectorBoard" Margin="0,0,200,0"/>
|
||||
<Grid Margin="0">
|
||||
<Canvas Name="Board" HorizontalAlignment="Left" Margin="0" VerticalAlignment="Top"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
|
@ -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<Columns;x++)
|
||||
Canvas.SetLeft(garbageCollector.Image, garbageCollector.Coords.X * 100);
|
||||
Canvas.SetTop(garbageCollector.Image, garbageCollector.Coords.Y * 100);
|
||||
Board.Children.Add(garbageCollector.Image);
|
||||
for (int y=0;y<Rows;y++)
|
||||
{
|
||||
for (int y = 0; y < Rows; y++)
|
||||
for (int x = 0; x < Columns; x++)
|
||||
{
|
||||
var item = Objects[x, y];
|
||||
Grid.SetColumn(item.Image, x);
|
||||
Grid.SetRow(item.Image, y);
|
||||
Canvas.SetLeft(Objects[x, y].Image, x * 100);
|
||||
Canvas.SetTop(Objects[x, y].Image, y * 100);
|
||||
Board.Children.Add(item.Image);
|
||||
}
|
||||
}
|
||||
@ -72,44 +71,34 @@ namespace CzokoŚmieciarka.WPFv2
|
||||
|
||||
private void BoardInitialize()
|
||||
{
|
||||
ColumnDefinition column;
|
||||
RowDefinition row;
|
||||
for (int y = 0; y < Rows; y++)
|
||||
{
|
||||
column = new ColumnDefinition();
|
||||
row = new RowDefinition();
|
||||
Board.ColumnDefinitions.Add(column);
|
||||
Board.RowDefinitions.Add(row);
|
||||
column = new ColumnDefinition();
|
||||
row = new RowDefinition();
|
||||
CollectorBoard.ColumnDefinitions.Add(column);
|
||||
CollectorBoard.RowDefinitions.Add(row);
|
||||
for (int x = 0; x < Columns; x++)
|
||||
{
|
||||
Road road = new Road();
|
||||
Objects[x, y] = road;
|
||||
Grid.SetRow(Objects[x, y].Image, y);
|
||||
Grid.SetColumn(Objects[x, y].Image, x);
|
||||
Canvas.SetLeft(Objects[x, y].Image, x * 100);
|
||||
Canvas.SetTop(Objects[x, y].Image, y * 100);
|
||||
Board.Children.Add(Objects[x, y].Image);
|
||||
}
|
||||
|
||||
}
|
||||
Objects[2,7] = new WPFDump(new TypeOfGarbage(GarbageType.Glass,1,1), 10000,new Coords(2,7));
|
||||
Grid.SetColumn(Objects[2, 7].Image, 2);
|
||||
Grid.SetRow(Objects[2, 7].Image, 7);
|
||||
Board.Children.Add(Objects[2, 7].Image);
|
||||
Objects[3,7] = new WPFDump(new TypeOfGarbage(GarbageType.Organic,1,1),10000, new Coords(3,7));
|
||||
Grid.SetColumn(Objects[3, 7].Image, 3);
|
||||
Grid.SetRow(Objects[3, 7].Image, 7);
|
||||
Board.Children.Add(Objects[3, 7].Image);
|
||||
Objects[2,8] = new WPFDump(new TypeOfGarbage(GarbageType.Paper,1,1), 10000, new Coords(2,8));
|
||||
Grid.SetColumn(Objects[2, 8].Image, 2);
|
||||
Grid.SetRow(Objects[2, 8].Image, 8);
|
||||
Board.Children.Add(Objects[2, 8].Image);
|
||||
Objects[3,8] = new WPFDump(new TypeOfGarbage(GarbageType.PlasticMetal, 1,1), 10000, new Coords(3,8));
|
||||
Grid.SetColumn(Objects[3, 8].Image, 3);
|
||||
Grid.SetRow(Objects[3, 8].Image, 8);
|
||||
Board.Children.Add(Objects[3, 8].Image);
|
||||
//Objects[2,7] = new WPFDump(new TypeOfGarbage(GarbageType.Glass,1,1), 10000,new Coords(2,7));
|
||||
//Grid.SetColumn(Objects[2, 7].Image, 2);
|
||||
//Grid.SetRow(Objects[2, 7].Image, 7);
|
||||
//Board.Children.Add(Objects[2, 7].Image);
|
||||
//Objects[3,7] = new WPFDump(new TypeOfGarbage(GarbageType.Organic,1,1),10000, new Coords(3,7));
|
||||
//Grid.SetColumn(Objects[3, 7].Image, 3);
|
||||
//Grid.SetRow(Objects[3, 7].Image, 7);
|
||||
//Board.Children.Add(Objects[3, 7].Image);
|
||||
//Objects[2,8] = new WPFDump(new TypeOfGarbage(GarbageType.Paper,1,1), 10000, new Coords(2,8));
|
||||
//Grid.SetColumn(Objects[2, 8].Image, 2);
|
||||
//Grid.SetRow(Objects[2, 8].Image, 8);
|
||||
//Board.Children.Add(Objects[2, 8].Image);
|
||||
//Objects[3,8] = new WPFDump(new TypeOfGarbage(GarbageType.PlasticMetal, 1,1), 10000, new Coords(3,8));
|
||||
//Grid.SetColumn(Objects[3, 8].Image, 3);
|
||||
//Grid.SetRow(Objects[3, 8].Image, 8);
|
||||
//Board.Children.Add(Objects[3, 8].Image);
|
||||
|
||||
|
||||
GarbageCollectorContainers = new List<AGarbageCollectorContainer>()
|
||||
@ -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);
|
||||
|
||||
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
217
Trunk/MonoGameView/Algorithms/DFS.cs
Normal file
@ -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<IStep> BestPath(AGarbageCollector collector, object[,] grid)
|
||||
{
|
||||
var r=Search(collector, grid, 0).Key;
|
||||
Console.WriteLine(count);
|
||||
return r;
|
||||
}
|
||||
|
||||
List<IStep> PossibleSteps(AGarbageCollector collector, object[,] grid)
|
||||
{
|
||||
|
||||
|
||||
var result = new List<IStep>();
|
||||
var moveSteps = new List<IStep>()
|
||||
{
|
||||
new MoveStep(Direction.Up),
|
||||
new MoveStep(Direction.Down),
|
||||
new MoveStep(Direction.Left),
|
||||
new MoveStep(Direction.Right)
|
||||
};
|
||||
var filteredMoveSteps = new List<IStep>();
|
||||
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<List<IStep>, int> Search(AGarbageCollector collector, object[,] grid, int length)
|
||||
{
|
||||
count++;
|
||||
if (length > 40) return new KeyValuePair<List<IStep>, int>(new List<IStep>(), 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<List<IStep>, 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<IStep> BestPath(ContentManager content, AGarbageCollector collector, object[,] grid)
|
||||
{
|
||||
var r=Search(content, collector, grid, 0).Key;
|
||||
Console.WriteLine(count);
|
||||
return r;
|
||||
}
|
||||
|
||||
List<IStep> PossibleSteps(ContentManager content, AGarbageCollector collector, object[,] grid)
|
||||
{
|
||||
|
||||
|
||||
var result = new List<IStep>();
|
||||
var moveSteps = new List<IStep>()
|
||||
{
|
||||
new MoveStep(Direction.Up),
|
||||
new MoveStep(Direction.Down),
|
||||
new MoveStep(Direction.Left),
|
||||
new MoveStep(Direction.Right)
|
||||
};
|
||||
var filteredMoveSteps = new List<IStep>();
|
||||
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<List<IStep>, int> Search(ContentManager content, AGarbageCollector collector, object[,] grid, int length)
|
||||
{
|
||||
count++;
|
||||
if (length > 40) return new KeyValuePair<List<IStep>, int>(new List<IStep>(), 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<List<IStep>, 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
|
@ -1,4 +1,4 @@
|
||||
namespace CzokoŚmieciarka.DataModels.Enums
|
||||
namespace CzokoŚmieciarka.MonoGameView.DataModels.Enums
|
||||
{
|
||||
public enum Direction
|
||||
{
|
@ -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
|
||||
{
|
@ -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)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -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
|
||||
{
|
@ -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
|
||||
{
|
@ -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<AGarbageCollectorContainer> 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<AGarbageCollectorContainer> 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<AGarbageCollectorContainer> 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<AGarbageCollectorContainer> TrashContainers { get; }
|
||||
public object Clone()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
10
Trunk/MonoGameView/DataModels/Interfaces/IDrawables.cs
Normal file
@ -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);
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
12
Trunk/MonoGameView/DataModels/Interfaces/IHouse.cs
Normal file
@ -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
|
||||
{
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
||||
}
|
||||
}
|
9
Trunk/MonoGameView/DataModels/Interfaces/IStep.cs
Normal file
@ -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);
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
@ -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
|
||||
{
|
@ -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
|
||||
{
|
@ -1,4 +1,4 @@
|
||||
namespace CzokoŚmieciarka.DataModels.Interfaces.TrashCans
|
||||
namespace CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.TrashCans
|
||||
{
|
||||
public abstract class AGarbageCollectorContainer : ATrashCan
|
||||
{
|
@ -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
|
||||
{
|
55
Trunk/MonoGameView/DataModels/MapLoader.cs
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
13
Trunk/MonoGameView/DataModels/Models/Dump.cs
Normal file
@ -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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
33
Trunk/MonoGameView/DataModels/Models/GarbageCollector.cs
Normal file
@ -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<AGarbageCollectorContainer> l, int rows, int cols) : base(c,l,rows,cols)
|
||||
{
|
||||
}
|
||||
|
||||
public void Draw(ContentManager content, SpriteBatch batch,int size)
|
||||
{
|
||||
batch.Draw(content.Load<Texture2D>("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<AGarbageCollectorContainer>();
|
||||
return new GarbageCollector(new Coords(Coords.X,Coords.Y), cloneList, rows,columns);
|
||||
}
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
@ -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
|
||||
{
|
28
Trunk/MonoGameView/DataModels/Models/Grass.cs
Normal file
@ -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<Texture2D>("grass"), new Rectangle(Coords.X * 500 / size, Coords.Y * 500 / size, 500 / size, 500 / size), Color.White);
|
||||
}
|
||||
}
|
||||
}
|
26
Trunk/MonoGameView/DataModels/Models/House.cs
Normal file
@ -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<Texture2D>("house"), new Rectangle(Coords.X * 500 / size, Coords.Y * 500 / size, 500 / size, 500 / size), Color.White);
|
||||
}
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
27
Trunk/MonoGameView/DataModels/Models/Road1.cs
Normal file
@ -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<Texture2D>("grass"), new Rectangle(Coords.X * 500 / size, Coords.Y * 500 / size, 500 / size, 500 / size), Color.White);
|
||||
}
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
@ -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)
|
||||
{
|
@ -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
|
||||
{
|
@ -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
|
||||
{
|
@ -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
|
||||
{
|
@ -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
|
||||
/// </summary>
|
||||
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<IStep> 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<AGarbageCollectorContainer>(), 10, 10);
|
||||
mapLoader.Load(out size,out grid,"map.xml");
|
||||
collector = new GarbageCollector(new Coords(0, 0), new List<AGarbageCollectorContainer>(), 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<Texture2D>("road1");
|
||||
road2 = Content.Load<Texture2D>("road2");
|
||||
grass = Content.Load<Texture2D>("grass");
|
||||
house = Content.Load<Texture2D>("house");
|
||||
// TODO: use this.Content to load your game content here
|
||||
}
|
||||
|
||||
@ -91,6 +99,7 @@ namespace CzokoŚmieciarka.MonoGameView
|
||||
/// </summary>
|
||||
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
|
||||
|
@ -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<AGarbageCollectorContainer> l, int rows, int cols) : base(c,l,rows,cols)
|
||||
{
|
||||
Image = content.Load<Texture2D>("collector");
|
||||
}
|
||||
public GarbageCollector(Texture2D image, Coords c, List<AGarbageCollectorContainer> 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<AGarbageCollectorContainer>();
|
||||
return new GarbageCollector(Image, new Coords(Coords.X,Coords.Y), cloneList, rows,columns);
|
||||
}
|
||||
}
|
||||
}
|
@ -42,8 +42,44 @@
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Algorithms\DFS.cs" />
|
||||
<Compile Include="DataModels\Enums\Directions.cs" />
|
||||
<Compile Include="DataModels\Enums\GarbageTypes.cs" />
|
||||
<Compile Include="DataModels\Exceptions\Exceptions.cs" />
|
||||
<Compile Include="DataModels\Interfaces\GarbageCollector\AGarbageCollector.cs" />
|
||||
<Compile Include="DataModels\Interfaces\GarbageCollector\IGarbageCollector.cs" />
|
||||
<Compile Include="DataModels\Interfaces\Garbage\AGarbage.cs" />
|
||||
<Compile Include="DataModels\Interfaces\Garbage\IGarbage.cs" />
|
||||
<Compile Include="DataModels\Interfaces\IDrawables.cs" />
|
||||
<Compile Include="DataModels\Interfaces\IGarbageLocalization.cs" />
|
||||
<Compile Include="DataModels\Interfaces\IHouse.cs" />
|
||||
<Compile Include="DataModels\Interfaces\IRoad.cs" />
|
||||
<Compile Include="DataModels\Interfaces\IRoad1.cs" />
|
||||
<Compile Include="DataModels\Interfaces\IRoad2.cs" />
|
||||
<Compile Include="DataModels\Interfaces\IStep.cs" />
|
||||
<Compile Include="DataModels\Interfaces\ITypeOfGarbage.cs" />
|
||||
<Compile Include="DataModels\Interfaces\RoutePlanningEngine\IRoutePlanningEngine.cs" />
|
||||
<Compile Include="DataModels\Interfaces\TrashCans\ADump.cs" />
|
||||
<Compile Include="DataModels\Interfaces\TrashCans\AGarbageCollectorContainer.cs" />
|
||||
<Compile Include="DataModels\Interfaces\TrashCans\ATrashCan.cs" />
|
||||
<Compile Include="DataModels\MapLoader.cs" />
|
||||
<Compile Include="DataModels\Models\Coords.cs" />
|
||||
<Compile Include="DataModels\Models\Dump.cs" />
|
||||
<Compile Include="DataModels\Models\Garbage.cs" />
|
||||
<Compile Include="DataModels\Models\GarbageCollectorContainer.cs" />
|
||||
<Compile Include="DataModels\Models\GarbageLocalization.cs" />
|
||||
<Compile Include="DataModels\Models\Grass.cs" />
|
||||
<Compile Include="DataModels\Models\House.cs" />
|
||||
<Compile Include="DataModels\Models\Map.cs" />
|
||||
<Compile Include="DataModels\Models\Road1.cs" />
|
||||
<Compile Include="DataModels\Models\Road2.cs" />
|
||||
<Compile Include="DataModels\Models\Steps\CollectStep.cs" />
|
||||
<Compile Include="DataModels\Models\Steps\MoveStep.cs" />
|
||||
<Compile Include="DataModels\Models\Steps\SpillStep.cs" />
|
||||
<Compile Include="DataModels\Models\TrashCan.cs" />
|
||||
<Compile Include="DataModels\Models\TypeOfGarbage.cs" />
|
||||
<Compile Include="Game1.cs" />
|
||||
<Compile Include="GarbageCollector.cs" />
|
||||
<Compile Include="DataModels\Models\GarbageCollector.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
@ -62,20 +98,7 @@
|
||||
<None Include="app.config" />
|
||||
<None Include="app.manifest" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Components\CzokoŚmieciarka.AI_Naive\CzokoŚmieciarka.AI_Naive.csproj">
|
||||
<Project>{10e77bbe-55e1-483d-a456-0e94eac9b24a}</Project>
|
||||
<Name>CzokoŚmieciarka.AI_Naive</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Components\CzokoŚmieciarka.DataModels.GeneralModels\CzokoŚmieciarka.DataModels.GeneralModels.csproj">
|
||||
<Project>{a3d5da96-69d7-463f-b1ee-6fc70716e3b2}</Project>
|
||||
<Name>CzokoŚmieciarka.DataModels.GeneralModels</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Components\CzokoŚmieciarka.DataModels\CzokoŚmieciarka.DataModels.csproj">
|
||||
<Project>{f2e11fee-c5ac-47d2-ba9c-819909b6dff7}</Project>
|
||||
<Name>CzokoŚmieciarka.DataModels</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|