Optimal path for square map
This commit is contained in:
@@ -9,13 +9,14 @@
|
|||||||
<e p="CoreModule.cs" t="Include" />
|
<e p="CoreModule.cs" t="Include" />
|
||||||
<e p="IJsonDeserializor.cs" t="Include" />
|
<e p="IJsonDeserializor.cs" t="Include" />
|
||||||
<e p="IModule.cs" t="Include" />
|
<e p="IModule.cs" t="Include" />
|
||||||
|
<e p="IPathPlanner.cs" t="Include" />
|
||||||
<e p="ISimRunner.cs" t="Include" />
|
<e p="ISimRunner.cs" t="Include" />
|
||||||
<e p="IUserConsole.cs" t="Include" />
|
<e p="IUserConsole.cs" t="Include" />
|
||||||
<e p="IVehicle.cs" t="Include" />
|
<e p="IVehicle.cs" t="Include" />
|
||||||
<e p="JsonDeserializor.cs" t="Include" />
|
<e p="JsonDeserializor.cs" t="Include" />
|
||||||
<e p="Maps" t="Include">
|
<e p="Maps" t="Include">
|
||||||
<e p="Cell.cs" t="Include" />
|
<e p="Cell.cs" t="Include" />
|
||||||
<e p="Direction.cs" t="Include" />
|
<e p="GlobalDirection.cs" t="Include" />
|
||||||
<e p="Heading.cs" t="Include" />
|
<e p="Heading.cs" t="Include" />
|
||||||
<e p="HexMap.cs" t="Include" />
|
<e p="HexMap.cs" t="Include" />
|
||||||
<e p="ICell.cs" t="Include" />
|
<e p="ICell.cs" t="Include" />
|
||||||
@@ -27,12 +28,13 @@
|
|||||||
<e p="SquareMap.cs" t="Include" />
|
<e p="SquareMap.cs" t="Include" />
|
||||||
</e>
|
</e>
|
||||||
<e p="obj" t="ExcludeRecursive">
|
<e p="obj" t="ExcludeRecursive">
|
||||||
<e p="Release" t="Include">
|
<e p="Debug" t="Include">
|
||||||
<e p="netcoreapp3.1" t="Include">
|
<e p="netcoreapp3.1" t="Include">
|
||||||
<e p="ConsoleApp.AssemblyInfo.cs" t="Include" />
|
<e p="ConsoleApp.AssemblyInfo.cs" t="Include" />
|
||||||
</e>
|
</e>
|
||||||
</e>
|
</e>
|
||||||
</e>
|
</e>
|
||||||
|
<e p="PathPlanner.cs" t="Include" />
|
||||||
<e p="Program.cs" t="Include" />
|
<e p="Program.cs" t="Include" />
|
||||||
<e p="SimRunner.cs" t="Include" />
|
<e p="SimRunner.cs" t="Include" />
|
||||||
<e p="UserConsole.cs" t="Include" />
|
<e p="UserConsole.cs" t="Include" />
|
||||||
@@ -43,6 +45,7 @@
|
|||||||
<e p="packages" t="ExcludeRecursive" />
|
<e p="packages" t="ExcludeRecursive" />
|
||||||
<e p="RobotIntelFinal.sln" t="IncludeFlat" />
|
<e p="RobotIntelFinal.sln" t="IncludeFlat" />
|
||||||
</e>
|
</e>
|
||||||
|
<e p="$APPLICATION_CONFIG_DIR$/consoles/ide" t="IncludeRecursive" />
|
||||||
<e p="$USER_HOME$/Library/Caches/JetBrains/Rider2020.3/extResources" t="IncludeRecursive" />
|
<e p="$USER_HOME$/Library/Caches/JetBrains/Rider2020.3/extResources" t="IncludeRecursive" />
|
||||||
<e p="$USER_HOME$/Library/Caches/JetBrains/Rider2020.3/resharper-host/local/Transient/Rider/v203/SolutionCaches/_RobotIntelFinal.-1349721189.00" t="ExcludeRecursive" />
|
<e p="$USER_HOME$/Library/Caches/JetBrains/Rider2020.3/resharper-host/local/Transient/Rider/v203/SolutionCaches/_RobotIntelFinal.-1349721189.00" t="ExcludeRecursive" />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
95
.idea/.idea.RobotIntelFinal/.idea/workspace.xml
generated
95
.idea/.idea.RobotIntelFinal/.idea/workspace.xml
generated
@@ -18,24 +18,18 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="dafcaeb7-80aa-43a3-a480-786fafb78c0b" name="Default Changelist" comment="">
|
<list default="true" id="dafcaeb7-80aa-43a3-a480-786fafb78c0b" name="Default Changelist" comment="">
|
||||||
|
<change afterPath="$PROJECT_DIR$/ConsoleApp/IPathPlanner.cs" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/ConsoleApp/Maps/GlobalDirection.cs" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/ConsoleApp/PathPlanner.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/modules.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/modules.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/ConsoleApp.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/ConsoleApp.csproj" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/CoreModule.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/CoreModule.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/IVehicle.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/IVehicle.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/Direction.cs" beforeDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/Heading.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/Heading.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/Heading.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/Heading.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/HexCell.cs" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/IHexCell.cs" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/IMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/IMap.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/IMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/IMap.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/IMapFactory.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/IMapFactory.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/ISquareCell.cs" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/MapFactory.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/MapFactory.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/SquareCell.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/Cell.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/Vehicle.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Vehicle.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/RobotIntelFinal.sln.DotSettings.user" beforeDir="false" afterPath="$PROJECT_DIR$/RobotIntelFinal.sln.DotSettings.user" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -53,11 +47,29 @@
|
|||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
</component>
|
</component>
|
||||||
<component name="HighlightingSettingsPerFile">
|
<component name="HighlightingSettingsPerFile">
|
||||||
|
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/8B2EA1A3-95EB-49F7-AF97-CA55CE776F10/4/Container.cs" root0="SKIP_HIGHLIGHTING" />
|
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/8B2EA1A3-95EB-49F7-AF97-CA55CE776F10/4/Container.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
</component>
|
</component>
|
||||||
<component name="IdeDocumentHistory">
|
<component name="IdeDocumentHistory">
|
||||||
<changedPaths>
|
<changedPaths>
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Maps/Heading.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/Heading.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/Direction.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/GlobalDirection.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IMap.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/IPathPlanner.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/CoreModule.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanner.cs" />
|
||||||
</changedPaths>
|
</changedPaths>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectId" id="1lIZ7IfsUjzqV2Jb1obOFvGFAfp" />
|
<component name="ProjectId" id="1lIZ7IfsUjzqV2Jb1obOFvGFAfp" />
|
||||||
@@ -74,14 +86,15 @@
|
|||||||
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
||||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||||
<property name="nodejs_package_manager_path" value="npm" />
|
<property name="nodejs_package_manager_path" value="npm" />
|
||||||
<property name="settings.editor.selected.configurable" value="SolutionBuilderGeneralOptionsPageId" />
|
<property name="restartRequiresConfirmation" value="false" />
|
||||||
|
<property name="settings.editor.selected.configurable" value="project.propDebugger" />
|
||||||
<property name="vue.rearranger.settings.migration" value="true" />
|
<property name="vue.rearranger.settings.migration" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager" selected=".NET Project.ConsoleApp">
|
<component name="RunManager" selected=".NET Project.ConsoleApp">
|
||||||
<configuration name="ConsoleApp" type="DotNetProject" factoryName=".NET Project">
|
<configuration name="ConsoleApp" type="DotNetProject" factoryName=".NET Project">
|
||||||
<option name="EXE_PATH" value="" />
|
<option name="EXE_PATH" value="$PROJECT_DIR$/ConsoleApp/bin/Debug/netcoreapp3.1/ConsoleApp.dll" />
|
||||||
<option name="PROGRAM_PARAMETERS" value="" />
|
<option name="PROGRAM_PARAMETERS" value="" />
|
||||||
<option name="WORKING_DIRECTORY" value="" />
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/ConsoleApp/bin/Debug/netcoreapp3.1" />
|
||||||
<option name="PASS_PARENT_ENVS" value="1" />
|
<option name="PASS_PARENT_ENVS" value="1" />
|
||||||
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
<option name="USE_EXTERNAL_CONSOLE" value="0" />
|
||||||
<option name="USE_MONO" value="0" />
|
<option name="USE_MONO" value="0" />
|
||||||
@@ -91,7 +104,7 @@
|
|||||||
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
|
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
|
||||||
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
|
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />
|
||||||
<option name="PROJECT_KIND" value="DotNetCore" />
|
<option name="PROJECT_KIND" value="DotNetCore" />
|
||||||
<option name="PROJECT_TFM" value="" />
|
<option name="PROJECT_TFM" value=".NETCoreApp,Version=v3.1" />
|
||||||
<method v="2">
|
<method v="2">
|
||||||
<option name="Build" />
|
<option name="Build" />
|
||||||
</method>
|
</method>
|
||||||
@@ -114,6 +127,10 @@
|
|||||||
<option name="Build" />
|
<option name="Build" />
|
||||||
</method>
|
</method>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
<list>
|
||||||
|
<item itemvalue=".NET Project.ConsoleApp" />
|
||||||
|
<item itemvalue=".NET Project.Simulator" />
|
||||||
|
</list>
|
||||||
</component>
|
</component>
|
||||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||||
<component name="TaskManager">
|
<component name="TaskManager">
|
||||||
@@ -129,7 +146,8 @@
|
|||||||
<workItem from="1607640550443" duration="19992000" />
|
<workItem from="1607640550443" duration="19992000" />
|
||||||
<workItem from="1607982179018" duration="634000" />
|
<workItem from="1607982179018" duration="634000" />
|
||||||
<workItem from="1607983288378" duration="86000" />
|
<workItem from="1607983288378" duration="86000" />
|
||||||
<workItem from="1607983862958" duration="1794000" />
|
<workItem from="1607983862958" duration="7777000" />
|
||||||
|
<workItem from="1607993290571" duration="1876000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
@@ -153,4 +171,49 @@
|
|||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
|
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="XDebuggerManager">
|
||||||
|
<breakpoint-manager>
|
||||||
|
<breakpoints>
|
||||||
|
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||||
|
<url>file://$PROJECT_DIR$/ConsoleApp/SimRunner.cs</url>
|
||||||
|
<line>49</line>
|
||||||
|
<properties documentPath="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" initialLine="49" containingFunctionPresentation="method 'SquareSimulation'">
|
||||||
|
<startOffsets>
|
||||||
|
<option value="1400" />
|
||||||
|
</startOffsets>
|
||||||
|
<endOffsets>
|
||||||
|
<option value="1427" />
|
||||||
|
</endOffsets>
|
||||||
|
</properties>
|
||||||
|
<option name="timeStamp" value="5" />
|
||||||
|
</line-breakpoint>
|
||||||
|
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||||
|
<url>file://$PROJECT_DIR$/ConsoleApp/SimRunner.cs</url>
|
||||||
|
<line>47</line>
|
||||||
|
<properties documentPath="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" initialLine="47" containingFunctionPresentation="method 'SquareSimulation'">
|
||||||
|
<startOffsets>
|
||||||
|
<option value="1340" />
|
||||||
|
</startOffsets>
|
||||||
|
<endOffsets>
|
||||||
|
<option value="1369" />
|
||||||
|
</endOffsets>
|
||||||
|
</properties>
|
||||||
|
<option name="timeStamp" value="19" />
|
||||||
|
</line-breakpoint>
|
||||||
|
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||||
|
<url>file://$PROJECT_DIR$/ConsoleApp/PathPlanner.cs</url>
|
||||||
|
<line>34</line>
|
||||||
|
<properties documentPath="$PROJECT_DIR$/ConsoleApp/PathPlanner.cs" initialLine="34" containingFunctionPresentation="method 'GenerateOptimalSquarePath'">
|
||||||
|
<startOffsets>
|
||||||
|
<option value="1420" />
|
||||||
|
</startOffsets>
|
||||||
|
<endOffsets>
|
||||||
|
<option value="1436" />
|
||||||
|
</endOffsets>
|
||||||
|
</properties>
|
||||||
|
<option name="timeStamp" value="24" />
|
||||||
|
</line-breakpoint>
|
||||||
|
</breakpoints>
|
||||||
|
</breakpoint-manager>
|
||||||
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -13,6 +13,7 @@ namespace ConsoleApp
|
|||||||
container.Register<ISimRunner, SimRunner>(Reuse.Singleton);
|
container.Register<ISimRunner, SimRunner>(Reuse.Singleton);
|
||||||
container.Register<IVehicle, Vehicle>(Reuse.Singleton);
|
container.Register<IVehicle, Vehicle>(Reuse.Singleton);
|
||||||
container.Register<IJsonDeserializor, JsonDeserializor>(Reuse.Singleton);
|
container.Register<IJsonDeserializor, JsonDeserializor>(Reuse.Singleton);
|
||||||
|
container.Register<IPathPlanner, PathPlanner>(Reuse.Singleton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
$HEADER$namespace $NAMESPACE$
|
using System.Collections.Generic;
|
||||||
|
using ConsoleApp.Maps;
|
||||||
|
|
||||||
|
namespace ConsoleApp
|
||||||
{
|
{
|
||||||
public interface $INTERFACE$ {$END$}
|
public interface IPathPlanner
|
||||||
|
{
|
||||||
|
Queue<ICell> GenerateOptimalSquarePath(SquareMap map, IVehicle vehicle);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
namespace ConsoleApp.Maps
|
namespace ConsoleApp.Maps
|
||||||
{
|
{
|
||||||
public enum Direction
|
public enum GlobalDirection
|
||||||
{
|
{
|
||||||
|
North,
|
||||||
|
South,
|
||||||
|
East,
|
||||||
|
West
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
using System.Net.NetworkInformation;
|
|
||||||
|
|
||||||
namespace ConsoleApp.Maps
|
namespace ConsoleApp.Maps
|
||||||
{
|
{
|
||||||
public class Oreientation
|
public class Oreientation
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ namespace ConsoleApp.Maps
|
|||||||
public class HexMap : IHexMap
|
public class HexMap : IHexMap
|
||||||
{
|
{
|
||||||
public Cell[,] Map { get; }
|
public Cell[,] Map { get; }
|
||||||
public ICell StartingCell { get; }
|
public Cell StartingCell { get; }
|
||||||
public ICell LastCell { get; }
|
public Cell LastCell { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generate Hex map with cells of 25cm X 25cm
|
/// Generate Hex map with cells of 25cm X 25cm
|
||||||
@@ -23,9 +23,11 @@ namespace ConsoleApp.Maps
|
|||||||
var xCellCount = (int)Math.Ceiling((decimal) (x) / 25);
|
var xCellCount = (int)Math.Ceiling((decimal) (x) / 25);
|
||||||
var yCellCount = (int)Math.Ceiling((decimal) (y) / 25);
|
var yCellCount = (int)Math.Ceiling((decimal) (y) / 25);
|
||||||
|
|
||||||
|
//Initialize Map
|
||||||
|
Map = new Cell[xCellCount, yCellCount];
|
||||||
|
|
||||||
//set last cell;
|
//set last cell;
|
||||||
StartingCell = Map[0, 0];
|
StartingCell = Map[0, 0];
|
||||||
Map = new Cell[xCellCount, yCellCount];
|
|
||||||
for (int r = 0; r < yCellCount; r++) {
|
for (int r = 0; r < yCellCount; r++) {
|
||||||
int r_offset = Convert.ToInt32(Math.Floor(Convert.ToDouble(r)/2));
|
int r_offset = Convert.ToInt32(Math.Floor(Convert.ToDouble(r)/2));
|
||||||
for (int q = r_offset; q < xCellCount - r_offset; q++) {
|
for (int q = r_offset; q < xCellCount - r_offset; q++) {
|
||||||
@@ -35,7 +37,7 @@ namespace ConsoleApp.Maps
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ICell> PossibleMoves(ICell currentCell)
|
public List<GlobalDirection> PossibleMoves(ICell currentCell)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ namespace ConsoleApp.Maps
|
|||||||
public interface IMap
|
public interface IMap
|
||||||
{
|
{
|
||||||
public Cell[,] Map { get; }
|
public Cell[,] Map { get; }
|
||||||
ICell StartingCell { get; }
|
Cell StartingCell { get; }
|
||||||
ICell LastCell { get; }
|
Cell LastCell { get; }
|
||||||
public List<ICell> PossibleMoves(ICell currentCell);
|
public List<GlobalDirection> PossibleMoves(ICell currentCell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,9 +6,14 @@ namespace ConsoleApp.Maps
|
|||||||
public class SquareMap : ISquareMap
|
public class SquareMap : ISquareMap
|
||||||
{
|
{
|
||||||
public Cell[,] Map { get;}
|
public Cell[,] Map { get;}
|
||||||
public ICell StartingCell { get; }
|
public Cell StartingCell { get; }
|
||||||
public ICell LastCell { get; }
|
public Cell LastCell { get; }
|
||||||
|
public int Height { get; }
|
||||||
|
public int Width { get; }
|
||||||
|
|
||||||
|
|
||||||
|
private int _mapWidth;
|
||||||
|
private int _mapHeight;
|
||||||
public SquareMap(int x, int y)
|
public SquareMap(int x, int y)
|
||||||
{
|
{
|
||||||
//convert to cm
|
//convert to cm
|
||||||
@@ -18,31 +23,43 @@ namespace ConsoleApp.Maps
|
|||||||
var xCellCount = (int)Math.Ceiling((decimal) (x) / 25);
|
var xCellCount = (int)Math.Ceiling((decimal) (x) / 25);
|
||||||
var yCellCount = (int)Math.Ceiling((decimal) (y) / 25);
|
var yCellCount = (int)Math.Ceiling((decimal) (y) / 25);
|
||||||
|
|
||||||
|
//set Width and height fields
|
||||||
|
_mapWidth = xCellCount-1;
|
||||||
|
_mapHeight = yCellCount-1;
|
||||||
|
Height = _mapHeight;
|
||||||
|
Width = _mapWidth;
|
||||||
|
|
||||||
|
//Initialize Map
|
||||||
|
Map = new Cell[xCellCount, yCellCount];
|
||||||
|
|
||||||
//set last cell;
|
//set last cell;
|
||||||
StartingCell = Map[0, 0];
|
StartingCell = Map[0, 0];
|
||||||
Map = new Cell[xCellCount, yCellCount];
|
for (int i = 0; i < xCellCount; i++)
|
||||||
for (int i = 0; i < x; i++)
|
|
||||||
{
|
{
|
||||||
for (int j = 0; j < y; j++)
|
for (int j = 0; j < yCellCount; j++)
|
||||||
{
|
{
|
||||||
Map[i,j] = new Cell(i, j);
|
Map[i,j] = new Cell(i, j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ICell> PossibleMoves(ICell currentCell)
|
|
||||||
|
public List<GlobalDirection> PossibleMoves(ICell currentCell)
|
||||||
{
|
{
|
||||||
var forward = (currentCell.X , currentCell.Y + 1);
|
|
||||||
var backwards= (currentCell.X , currentCell.Y - 1);
|
var possibles = new List<GlobalDirection>();
|
||||||
var right = (currentCell.X + 1, currentCell.Y);
|
if (currentCell.X != 0)
|
||||||
var left = (currentCell.X - 1, currentCell.Y);
|
possibles.Add(GlobalDirection.West);
|
||||||
var possibles = new List<ICell>();
|
if (currentCell.X != _mapWidth)
|
||||||
possibles.Add(Map[forward.Item1, forward.Item2]);
|
possibles.Add(GlobalDirection.East);
|
||||||
possibles.Add(Map[backwards.Item1, backwards.Item2]);
|
if (currentCell.Y != _mapHeight)
|
||||||
possibles.Add(Map[right.Item1, right.Item2]);
|
possibles.Add(GlobalDirection.North);
|
||||||
possibles.Add(Map[left.Item1, left.Item2]);
|
if (currentCell.Y != 0)
|
||||||
|
possibles.Add(GlobalDirection.South);
|
||||||
|
|
||||||
return possibles;
|
return possibles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Cell this[in int x, in int y] => Map[x, y];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,56 @@
|
|||||||
$HEADER$namespace $NAMESPACE$
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using ConsoleApp.Maps;
|
||||||
|
|
||||||
|
namespace ConsoleApp
|
||||||
{
|
{
|
||||||
public class $CLASS$ {$END$}
|
public class PathPlanner : IPathPlanner
|
||||||
|
{
|
||||||
|
public Queue<ICell> GenerateOptimalSquarePath(SquareMap map, IVehicle vehicle)
|
||||||
|
{
|
||||||
|
var path = new Queue<ICell>();
|
||||||
|
var myCell = map.StartingCell;
|
||||||
|
var finished = false;
|
||||||
|
var width_cm = (double)(vehicle.DetectorWidth) * 100;
|
||||||
|
var swathOffset = (int)Math.Floor((decimal) (width_cm) / 25) + 1;
|
||||||
|
var currentHeading = GlobalDirection.North;
|
||||||
|
while (!finished)
|
||||||
|
{
|
||||||
|
var availableMoves = map.PossibleMoves(myCell);
|
||||||
|
if (availableMoves.Contains(GlobalDirection.North) && currentHeading == GlobalDirection.North &&
|
||||||
|
myCell.Y != map.Height)
|
||||||
|
{
|
||||||
|
path.Enqueue(map[myCell.X, myCell.Y + 1]);
|
||||||
|
myCell = map[myCell.X, myCell.Y + 1];
|
||||||
|
}
|
||||||
|
else if (availableMoves.Contains(GlobalDirection.South) && currentHeading == GlobalDirection.South && myCell.Y != 0)
|
||||||
|
{
|
||||||
|
path.Enqueue(map[myCell.X, myCell.Y - 1]);
|
||||||
|
myCell = map[myCell.X, myCell.Y - 1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (myCell.X + swathOffset >= map.Width)
|
||||||
|
{
|
||||||
|
finished = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = myCell.X; i < myCell.X + swathOffset; i++)
|
||||||
|
{
|
||||||
|
path.Enqueue(map[i, myCell.Y]);
|
||||||
|
}
|
||||||
|
myCell = map[myCell.X+swathOffset, myCell.Y];
|
||||||
|
if (currentHeading == GlobalDirection.North)
|
||||||
|
currentHeading = GlobalDirection.South;
|
||||||
|
else if (currentHeading == GlobalDirection.South)
|
||||||
|
currentHeading = GlobalDirection.North;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -10,58 +10,42 @@ namespace ConsoleApp
|
|||||||
{
|
{
|
||||||
private IMapFactory _mapFactory;
|
private IMapFactory _mapFactory;
|
||||||
private IVehicle _vehicle;
|
private IVehicle _vehicle;
|
||||||
private IMap _squareMap;
|
|
||||||
private IMap _hexMap;
|
|
||||||
private int _cellWidth;
|
private int _cellWidth;
|
||||||
|
private IPathPlanner _pathPlanner;
|
||||||
|
|
||||||
|
|
||||||
public SimRunner(IMapFactory mapFactory, IVehicle vehicle)
|
public SimRunner(IMapFactory mapFactory, IVehicle vehicle, IPathPlanner pathPlanner)
|
||||||
{
|
{
|
||||||
_squareMap = mapFactory.Maps["SquareMap"];
|
|
||||||
_hexMap = mapFactory.Maps["HexMap"];
|
|
||||||
_cellWidth = mapFactory.CellWidth;
|
_cellWidth = mapFactory.CellWidth;
|
||||||
_mapFactory = mapFactory;
|
_mapFactory = mapFactory;
|
||||||
_vehicle = vehicle;
|
_vehicle = vehicle;
|
||||||
|
_pathPlanner = pathPlanner;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public void Run()
|
||||||
{
|
{
|
||||||
_vehicle.CurrentHexCell = _hexMap.StartingCell;
|
|
||||||
_vehicle.CurrentSquareCell = _squareMap.StartingCell;
|
SquareSimulation();
|
||||||
var squareTask = Task.Run(() => SquareSimulation());
|
// var hexTask = Task.Run(() => HexSimulation());
|
||||||
var hexTask = Task.Run(() => HexSimulation());
|
// while(!squareTask.IsCompleted && !hexTask.IsCompleted){Thread.Sleep(500);}
|
||||||
while(!squareTask.IsCompleted && !hexTask.IsCompleted){Thread.Sleep(500);}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HexSimulation()
|
private void HexSimulation()
|
||||||
{
|
{
|
||||||
|
var hexMap = (HexMap)_mapFactory.Maps["HexMap"];
|
||||||
var optimalPath = GenerateHexPath();
|
_vehicle.CurrentHexCell = hexMap.StartingCell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void SquareSimulation()
|
private void SquareSimulation()
|
||||||
{
|
{
|
||||||
var optimalPath = GenerateSquarePath();
|
var squareMap = (SquareMap)_mapFactory.Maps["SquareMap"];
|
||||||
|
_vehicle.CurrentSquareCell = squareMap.StartingCell;
|
||||||
|
var optimalPath = _pathPlanner.GenerateOptimalSquarePath(squareMap, _vehicle);
|
||||||
}
|
}
|
||||||
|
|
||||||
private object GenerateSquarePath()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Queue<ICell> GenerateHexPath()
|
|
||||||
{
|
|
||||||
var path = new Queue<ICell>();
|
|
||||||
var currentCell = _vehicle.CurrentHexCell;
|
|
||||||
var possibles = _hexMap.PossibleMoves(currentCell);
|
|
||||||
while (currentCell != _hexMap.LastCell)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user