Reasumując wszystkie aspekty kwintesencji tematu, dochodzę do fundamentalnej konkluzji, warto commitować
This commit is contained in:
parent
e1aac08c6b
commit
deeb13eb82
@ -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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
@ -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
|
||||
|
@ -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>
|
@ -1,109 +1,109 @@
|
||||
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;
|
||||
|
||||
namespace CzokoŚmieciarka.MonoGameView.Algorithms
|
||||
{
|
||||
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,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,67 @@
|
||||
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;
|
||||
|
||||
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()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerable<AGarbageCollectorContainer> TrashContainers { get; }
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
@ -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
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
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
|
||||
{
|
@ -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
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
|
||||
{
|
@ -1,9 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using CzokoŚmieciarka.DataModels.Interfaces.GarbageCollector;
|
||||
using CzokoŚmieciarka.DataModels.Interfaces.TrashCans;
|
||||
using CzokoŚmieciarka.DataModels.Models;
|
||||
using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces.GarbageCollector;
|
||||
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 GarbageCollector : AGarbageCollector
|
||||
{
|
@ -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
|
||||
{
|
13
Trunk/MonoGameView/DataModels/Models/House.cs
Normal file
13
Trunk/MonoGameView/DataModels/Models/House.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CzokoŚmieciarka.MonoGameView.DataModels.Interfaces;
|
||||
|
||||
namespace CzokoŚmieciarka.MonoGameView.DataModels.Models
|
||||
{
|
||||
public class House : IHouse
|
||||
{
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
@ -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 Road1 :IRoad1
|
||||
{
|
||||
}
|
||||
}
|
||||
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 Road1 :IRoad1
|
||||
{
|
||||
}
|
||||
}
|
@ -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,8 +1,7 @@
|
||||
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;
|
||||
@ -10,6 +9,7 @@ using MonoGameView;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CzokoŚmieciarka.MonoGameView.Algorithms;
|
||||
|
||||
namespace CzokoŚmieciarka.MonoGameView
|
||||
{
|
||||
@ -23,6 +23,7 @@ namespace CzokoŚmieciarka.MonoGameView
|
||||
Texture2D road1;
|
||||
Texture2D road2;
|
||||
Texture2D grass;
|
||||
Texture2D house;
|
||||
Vector2 roadPos;
|
||||
float timer;
|
||||
const float TIMER = 0.2f;
|
||||
@ -60,7 +61,8 @@ namespace CzokoŚmieciarka.MonoGameView
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
grid[4, 0] = new House();
|
||||
grid[6, 4] = new House();
|
||||
collector = new GarbageCollector(Content,new Coords(0, 0), new List<AGarbageCollectorContainer>(), 10, 10);
|
||||
|
||||
|
||||
@ -82,6 +84,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 +94,7 @@ namespace CzokoŚmieciarka.MonoGameView
|
||||
/// </summary>
|
||||
protected override void UnloadContent()
|
||||
{
|
||||
Content.Unload();
|
||||
// TODO: Unload any non ContentManager content here
|
||||
}
|
||||
|
||||
@ -139,6 +143,7 @@ namespace CzokoŚmieciarka.MonoGameView
|
||||
{
|
||||
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 if (grid[x, y] is House) spriteBatch.Draw(house, new Vector2(x*50, y*50), Color.White);
|
||||
else spriteBatch.Draw(grass, new Vector2(x * 50, y * 50), Color.White);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
using CzokoŚmieciarka.DataModels.Interfaces.GarbageCollector;
|
||||
using CzokoŚmieciarka.DataModels.Interfaces.TrashCans;
|
||||
using CzokoŚmieciarka.DataModels.Models;
|
||||
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.Content;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
@ -42,6 +42,40 @@
|
||||
<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\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\Models\Coords.cs" />
|
||||
<Compile Include="DataModels\Models\Dump.cs" />
|
||||
<Compile Include="DataModels\Models\Garbage.cs" />
|
||||
<Compile Include="DataModels\Models\GarbageCollector.cs" />
|
||||
<Compile Include="DataModels\Models\GarbageCollectorContainer.cs" />
|
||||
<Compile Include="DataModels\Models\GarbageLocalization.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="Program.cs" />
|
||||
@ -62,20 +96,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.
|
||||
|
Loading…
Reference in New Issue
Block a user