Compare commits
19 Commits
Bootstrapp
...
AddLogicTo
| Author | SHA1 | Date | |
|---|---|---|---|
| e8ffbd3151 | |||
| f8ce6d0c83 | |||
| cf432a348b | |||
| 4edcef4664 | |||
| 45eca3b572 | |||
| 00444fbba9 | |||
| 257aaa331f | |||
| 5bb82f7579 | |||
| 80ea690330 | |||
| d63066c150 | |||
| 2c5f0b73b9 | |||
| 3fee402da1 | |||
| d725372ffb | |||
| 7f0cb10198 | |||
| bd7264f893 | |||
| 63f158afd9 | |||
|
|
230e97e3df | ||
|
|
927fd0f64d | ||
|
|
817fbbb907 |
41
.idea/.idea.RobotIntelFinal/.idea/contentModel.xml
generated
41
.idea/.idea.RobotIntelFinal/.idea/contentModel.xml
generated
@@ -7,22 +7,28 @@
|
|||||||
<e p="Bootstrapper.cs" t="Include" />
|
<e p="Bootstrapper.cs" t="Include" />
|
||||||
<e p="ConsoleApp.csproj" t="IncludeRecursive" />
|
<e p="ConsoleApp.csproj" t="IncludeRecursive" />
|
||||||
<e p="CoreModule.cs" t="Include" />
|
<e p="CoreModule.cs" t="Include" />
|
||||||
|
<e p="HexPlot.py" t="Include" />
|
||||||
|
<e p="IJsonDeserializor.cs" t="Include" />
|
||||||
<e p="IModule.cs" t="Include" />
|
<e p="IModule.cs" t="Include" />
|
||||||
<e p="ISimRunner.cs" t="Include" />
|
<e p="ISimRunner.cs" t="Include" />
|
||||||
|
<e p="ISimulationResults.cs" t="Include" />
|
||||||
<e p="IUserConsole.cs" t="Include" />
|
<e p="IUserConsole.cs" t="Include" />
|
||||||
|
<e p="JsonDeserializor.cs" t="Include" />
|
||||||
<e p="Maps" t="Include">
|
<e p="Maps" t="Include">
|
||||||
<e p="HexCell.cs" t="Include" />
|
<e p="Cell.cs" t="Include" />
|
||||||
|
<e p="GlobalDirection.cs" t="Include" />
|
||||||
|
<e p="Heading.cs" t="Include" />
|
||||||
<e p="HexMap.cs" t="Include" />
|
<e p="HexMap.cs" t="Include" />
|
||||||
<e p="IHexCell.cs" t="Include" />
|
<e p="ICell.cs" t="Include" />
|
||||||
<e p="IHexMap.cs" t="Include" />
|
<e p="IHexMap.cs" t="Include" />
|
||||||
<e p="IMapFactory.cs" t="Include" />
|
<e p="IMapFactory.cs" t="Include" />
|
||||||
<e p="ISquareCell.cs" t="Include" />
|
<e p="IMineMap.cs" t="Include" />
|
||||||
<e p="ISquareMap.cs" t="Include" />
|
<e p="ISquareMap.cs" t="Include" />
|
||||||
|
<e p="MapExtensions.cs" t="Include" />
|
||||||
<e p="MapFactory.cs" t="Include" />
|
<e p="MapFactory.cs" t="Include" />
|
||||||
<e p="SquareCell.cs" t="Include" />
|
<e p="MineMap.cs" t="Include" />
|
||||||
<e p="SquareMap.cs" t="Include" />
|
<e p="SquareMap.cs" t="Include" />
|
||||||
</e>
|
</e>
|
||||||
<e p="Module.cs" t="Include" />
|
|
||||||
<e p="obj" t="ExcludeRecursive">
|
<e p="obj" t="ExcludeRecursive">
|
||||||
<e p="Debug" t="Include">
|
<e p="Debug" t="Include">
|
||||||
<e p="netcoreapp3.1" t="Include">
|
<e p="netcoreapp3.1" t="Include">
|
||||||
@@ -30,14 +36,35 @@
|
|||||||
</e>
|
</e>
|
||||||
</e>
|
</e>
|
||||||
</e>
|
</e>
|
||||||
|
<e p="Output" t="Include">
|
||||||
|
<e p="Data.txt" t="Include" />
|
||||||
|
<e p="HexDetectedMines.txt" t="Include" />
|
||||||
|
<e p="HexPath.txt" t="Include" />
|
||||||
|
<e p="HexTest.png" t="Include" />
|
||||||
|
</e>
|
||||||
|
<e p="PathPlanners" t="Include">
|
||||||
|
<e p="IPathPlanner.cs" t="Include" />
|
||||||
|
<e p="IReactivePathPlanner.cs" t="Include" />
|
||||||
|
<e p="PathPlanner.cs" t="Include" />
|
||||||
|
<e p="ReactivePathPlanner.cs" t="Include" />
|
||||||
|
</e>
|
||||||
<e p="Program.cs" t="Include" />
|
<e p="Program.cs" t="Include" />
|
||||||
|
<e p="Sim" t="Include">
|
||||||
|
<e p="DetectionHead.cs" t="Include" />
|
||||||
|
<e p="IVehicle.cs" t="Include" />
|
||||||
|
<e p="Vehicle.cs" t="Include" />
|
||||||
|
<e p="VehicleConfiguration.cs" t="Include" />
|
||||||
|
<e p="VehicleConfiguration.json" t="Include" />
|
||||||
|
</e>
|
||||||
<e p="SimRunner.cs" t="Include" />
|
<e p="SimRunner.cs" t="Include" />
|
||||||
|
<e p="SimulationResults.cs" t="Include" />
|
||||||
<e p="UserConsole.cs" t="Include" />
|
<e p="UserConsole.cs" t="Include" />
|
||||||
</e>
|
</e>
|
||||||
<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="$USER_HOME$/Library/Caches/JetBrains/Rider2020.2/extResources" t="IncludeRecursive" />
|
<e p="$APPLICATION_CONFIG_DIR$/consoles/ide" t="IncludeRecursive" />
|
||||||
<e p="$USER_HOME$/Library/Caches/JetBrains/Rider2020.2/resharper-host/local/Transient/Rider/v202/SolutionCaches/_RobotIntelFinal.-1349721189.00" t="ExcludeRecursive" />
|
<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" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
2
.idea/.idea.RobotIntelFinal/.idea/modules.xml
generated
2
.idea/.idea.RobotIntelFinal/.idea/modules.xml
generated
@@ -2,7 +2,7 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectModuleManager">
|
<component name="ProjectModuleManager">
|
||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/riderModule.iml" filepath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/riderModule.iml" />
|
<module fileurl="file://$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/riderModule.iml" filepath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/riderModule.iml" />
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
239
.idea/.idea.RobotIntelFinal/.idea/workspace.xml
generated
239
.idea/.idea.RobotIntelFinal/.idea/workspace.xml
generated
@@ -4,6 +4,9 @@
|
|||||||
<projectFile>Simulator/Simulator.csproj</projectFile>
|
<projectFile>Simulator/Simulator.csproj</projectFile>
|
||||||
<projectFile>ConsoleApp/ConsoleApp.csproj</projectFile>
|
<projectFile>ConsoleApp/ConsoleApp.csproj</projectFile>
|
||||||
</component>
|
</component>
|
||||||
|
<component name="AutoImportSettings">
|
||||||
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
|
</component>
|
||||||
<component name="BranchesTreeState">
|
<component name="BranchesTreeState">
|
||||||
<expand>
|
<expand>
|
||||||
<path>
|
<path>
|
||||||
@@ -15,67 +18,134 @@
|
|||||||
</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/Maps/HexCell.cs" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/ConsoleApp/ISimulationResults.cs" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/ConsoleApp/SimulationResults.cs" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/ConsoleApp/Maps/IHexCell.cs" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/ConsoleApp/Maps/IHexMap.cs" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/ConsoleApp/Maps/ISquareCell.cs" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/ConsoleApp/Maps/ISquareMap.cs" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/ConsoleApp/Maps/SquareCell.cs" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.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/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/Bootstrapper.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Bootstrapper.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/ConsoleApp.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/ConsoleApp.csproj" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/ISimRunner.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/ISimRunner.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/CoreModule.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/CoreModule.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/IMineMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/IMineMap.cs" afterDir="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/MineMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/MineMap.cs" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/Output/DetectedMines.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Output/DetectedMines.txt" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/Output/Mines.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Output/Mines.txt" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/Output/SavedList.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Output/SavedList.txt" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/Output/test.png" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Output/test.png" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/ConsoleApp/Program.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Program.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ConsoleApp/Program.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Program.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/plot.py" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/HexPlot.py" 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" />
|
||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="FileTemplateManagerImpl">
|
||||||
|
<option name="RECENT_TEMPLATES">
|
||||||
|
<list>
|
||||||
|
<option value="JSON File" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
<component name="Git.Settings">
|
<component name="Git.Settings">
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="HighlightingSettingsPerFile">
|
||||||
|
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/EE5CA5D4-EDEB-48AE-9C0D-FE354330FB77/f7/268fdeac/Graph.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/EB067793-5C3F-4219-AEF1-3AB117C20649/133/Thread.CoreCLR.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/7AFCB195-1BDF-4087-9F2D-5BFCFC407B2B/46/ThrowHelper.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/EB067793-5C3F-4219-AEF1-3AB117C20649/39B/EqualityComparer.CoreCLR.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/EB067793-5C3F-4219-AEF1-3AB117C20649/11/Array.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/EB067793-5C3F-4219-AEF1-3AB117C20649/3A4/List.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/7AFCB195-1BDF-4087-9F2D-5BFCFC407B2B/30/Where.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/EB067793-5C3F-4219-AEF1-3AB117C20649/389/Comparer.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="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/EE5CA5D4-EDEB-48AE-9C0D-FE354330FB77/3d/c367b191/Coordinate3D.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/DecompilerCache/decompiler/EE5CA5D4-EDEB-48AE-9C0D-FE354330FB77/14/12025305/MovementTypes.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/EE5CA5D4-EDEB-48AE-9C0D-FE354330FB77/0b/0953c23b/GraphFactory.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/DecompilerCache/decompiler/EE5CA5D4-EDEB-48AE-9C0D-FE354330FB77/84/4eb9c798/GraphUtils.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="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="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/EB067793-5C3F-4219-AEF1-3AB117C20649/B5/Random.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/1C5C65AB-6C84-402C-B333-F3A5A7121EFE/D/Queue.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
</component>
|
||||||
<component name="IdeDocumentHistory">
|
<component name="IdeDocumentHistory">
|
||||||
<option name="CHANGED_PATHS">
|
<changedPaths>
|
||||||
<list>
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/Heading.cs" />
|
||||||
<option value="$PROJECT_DIR$/Simulator/Program.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/Direction.cs" />
|
||||||
<option value="$PROJECT_DIR$/Simulator/CoreModule.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/IPathPlanner.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/IModule.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanner.cs" />
|
||||||
<option value="$PROJECT_DIR$/Simulator/SimulatorModule.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/GlobalDirection.cs" />
|
||||||
<option value="$PROJECT_DIR$/Simulator/NetworkInterfaceFactory.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/HexCoordinates.cs" />
|
||||||
<option value="$PROJECT_DIR$/Simulator/INetworkInterfaceFactory.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/IVehicle.cs" />
|
||||||
<option value="$PROJECT_DIR$/Simulator/NetworkInterface.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IMap.cs" />
|
||||||
<option value="$PROJECT_DIR$/Simulator/Networking/NetworkInterfaceFactory.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Vehicle.cs" />
|
||||||
<option value="$PROJECT_DIR$/Simulator/Networking/INetworkInterfaceFactory.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/ISquareMap.cs" />
|
||||||
<option value="$PROJECT_DIR$/Simulator/Networking/INetworkInterface.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Vehicle/DetectionHead.cs" />
|
||||||
<option value="$PROJECT_DIR$/Simulator/Networking/NetworkInterface.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Vehicle/Vehicle.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/IUserConsole.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Vehicle/VehicleConfiguration.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Module.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Vehicle/IVehicle.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/CoreModule.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/Cell.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/MapFactory.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/ICell.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/IPathPlanner.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/ConsoleApp.csproj" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/CellExtensions.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/MapExtensions.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/Sim/IVehicle.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IHexMap.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/IReactivePathPlanner.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/UserConsole.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/UserConsole.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/IMapFactory.cs" />
|
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Bootstrapper.cs" />
|
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IMapFactory.cs" />
|
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/ISimRunner.cs" />
|
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" />
|
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Program.cs" />
|
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Maps/MapFactory.cs" />
|
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IHexMap.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/MapFactory.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Maps/ISquareMap.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IMapFactory.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Maps/HexCell.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Sim/VehicleConfiguration.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IHexCell.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Sim/Vehicle.cs" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Maps/SquareCell.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Sim/VehicleConfiguration.json" />
|
||||||
<option value="$PROJECT_DIR$/ConsoleApp/Maps/ISquareCell.cs" />
|
<option value="$PROJECT_DIR$/ConsoleApp/Sim/DetectionHead.cs" />
|
||||||
</list>
|
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs" />
|
||||||
</option>
|
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/ReactivePathPlanner.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/CoreModule.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/plot.py" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/MineMap.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IMineMap.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/ISimulationResults.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/Program.cs" />
|
||||||
|
<option value="$PROJECT_DIR$/ConsoleApp/SimulationResults.cs" />
|
||||||
|
</changedPaths>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectId" id="1lIZ7IfsUjzqV2Jb1obOFvGFAfp" />
|
<component name="ProjectId" id="1lIZ7IfsUjzqV2Jb1obOFvGFAfp" />
|
||||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
|
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
|
||||||
@@ -86,15 +156,20 @@
|
|||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent">
|
<component name="PropertiesComponent">
|
||||||
|
<property name="DebuggerViewTab_PTCS_FirstProportionKey" value="0.3496007" />
|
||||||
|
<property name="DebuggerViewTab_PTCS_LastProportionKey" value="0.0" />
|
||||||
<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="restartRequiresConfirmation" value="false" />
|
||||||
|
<property name="settings.editor.selected.configurable" value="configurable.group.build" />
|
||||||
<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" />
|
||||||
@@ -104,7 +179,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>
|
||||||
@@ -127,6 +202,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">
|
||||||
@@ -137,6 +216,13 @@
|
|||||||
<option name="presentableId" value="Default" />
|
<option name="presentableId" value="Default" />
|
||||||
<updated>1607286398679</updated>
|
<updated>1607286398679</updated>
|
||||||
<workItem from="1607286402206" duration="6845000" />
|
<workItem from="1607286402206" duration="6845000" />
|
||||||
|
<workItem from="1607640133651" duration="318000" />
|
||||||
|
<workItem from="1607640470920" duration="58000" />
|
||||||
|
<workItem from="1607640550443" duration="19992000" />
|
||||||
|
<workItem from="1607982179018" duration="634000" />
|
||||||
|
<workItem from="1607983288378" duration="86000" />
|
||||||
|
<workItem from="1607983862958" duration="7777000" />
|
||||||
|
<workItem from="1607993290571" duration="72449000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
@@ -160,35 +246,34 @@
|
|||||||
<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="WindowStateProjectService">
|
<component name="XDebuggerManager">
|
||||||
<state width="1158" height="582" key="GridCell.Tab.0.bottom" timestamp="1607636097456">
|
<breakpoint-manager>
|
||||||
<screen x="1440" y="-782" width="1200" height="1920" />
|
<breakpoints>
|
||||||
</state>
|
<line-breakpoint enabled="true" type="DotNet Breakpoints">
|
||||||
<state width="1158" height="582" key="GridCell.Tab.0.bottom/0.0.1440.900/2640.-782.1200.1920/1440.-782.1200.1920@1440.-782.1200.1920" timestamp="1607636097456" />
|
<url>file://$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs</url>
|
||||||
<state width="1158" height="582" key="GridCell.Tab.0.center" timestamp="1607636097453">
|
<line>34</line>
|
||||||
<screen x="1440" y="-782" width="1200" height="1920" />
|
<properties documentPath="$PROJECT_DIR$/ConsoleApp/PathPlanner.cs" initialLine="34" containingFunctionPresentation="method 'GenerateOptimalSquarePath'">
|
||||||
</state>
|
<startOffsets>
|
||||||
<state width="1158" height="582" key="GridCell.Tab.0.center/0.0.1440.900/2640.-782.1200.1920/1440.-782.1200.1920@1440.-782.1200.1920" timestamp="1607636097453" />
|
<option value="1527" />
|
||||||
<state width="1158" height="582" key="GridCell.Tab.0.left" timestamp="1607636097452">
|
</startOffsets>
|
||||||
<screen x="1440" y="-782" width="1200" height="1920" />
|
<endOffsets>
|
||||||
</state>
|
<option value="1543" />
|
||||||
<state width="1158" height="582" key="GridCell.Tab.0.left/0.0.1440.900/2640.-782.1200.1920/1440.-782.1200.1920@1440.-782.1200.1920" timestamp="1607636097452" />
|
</endOffsets>
|
||||||
<state width="1158" height="582" key="GridCell.Tab.0.right" timestamp="1607636097454">
|
</properties>
|
||||||
<screen x="1440" y="-782" width="1200" height="1920" />
|
<option name="timeStamp" value="24" />
|
||||||
</state>
|
</line-breakpoint>
|
||||||
<state width="1158" height="582" key="GridCell.Tab.0.right/0.0.1440.900/2640.-782.1200.1920/1440.-782.1200.1920@1440.-782.1200.1920" timestamp="1607636097454" />
|
</breakpoints>
|
||||||
<state x="1640" y="-86" key="Rider.ProjectTemplateDialog.Size" timestamp="1607287214952">
|
</breakpoint-manager>
|
||||||
<screen x="1440" y="-782" width="1200" height="1920" />
|
<pin-to-top-manager>
|
||||||
</state>
|
<pinned-members>
|
||||||
<state x="1640" y="-86" key="Rider.ProjectTemplateDialog.Size/0.0.1440.900/2640.-782.1200.1920/1440.-782.1200.1920@1440.-782.1200.1920" timestamp="1607286605974" />
|
<PinnedItemInfo parentTag="Frame#ConsoleApp.PathPlanners.PathPlanner.GenerateOptimalHexPath" memberName="path" />
|
||||||
<state x="1640" y="-86" key="Rider.ProjectTemplateDialog.Size/0.25.1440.798/2640.-757.1200.1895/1440.-782.1200.1920@1440.-782.1200.1920" timestamp="1607287214952" />
|
</pinned-members>
|
||||||
<state x="1860" y="-144" key="RiderGenerateDialog" timestamp="1607636510472">
|
</pin-to-top-manager>
|
||||||
<screen x="1440" y="-782" width="1200" height="1920" />
|
<watches-manager>
|
||||||
</state>
|
<configuration name="DotNetProject">
|
||||||
<state x="1860" y="-144" key="RiderGenerateDialog/0.0.1440.900/2640.-782.1200.1920/1440.-782.1200.1920@1440.-782.1200.1920" timestamp="1607636510472" />
|
<watch expression="new System.Collections.Generic.QueueDebugView<HexCore.Coordinate2D>(optimalPath).Items[0]" />
|
||||||
<state x="1703" y="-333" width="672" height="678" key="search.everywhere.popup" timestamp="1607633696072">
|
<watch expression="Math.Abs(nextOptimal.X - _vehicle.CurrentHexCell.X) > 1 || Math.Abs(nextOptimal.Y - _vehicle.CurrentHexCell.Y) > 1" language="C#" />
|
||||||
<screen x="1440" y="-782" width="1200" height="1920" />
|
</configuration>
|
||||||
</state>
|
</watches-manager>
|
||||||
<state x="1703" y="-333" width="672" height="678" key="search.everywhere.popup/0.0.1440.900/2640.-782.1200.1920/1440.-782.1200.1920@1440.-782.1200.1920" timestamp="1607633696072" />
|
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -5,8 +5,30 @@
|
|||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="DryIoc.dll" Version="4.5.2" />
|
<PackageReference Include="DryIoc.dll" Version="4.5.2" />
|
||||||
|
<PackageReference Include="HexCore" Version="4.1.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="Sim\VehicleConfiguration.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Update="HexPlot.py">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Output" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,17 +1,24 @@
|
|||||||
using System.Threading;
|
using ConsoleApp.Maps;
|
||||||
using ConsoleApp;
|
using ConsoleApp.PathPlanners;
|
||||||
|
using ConsoleApp.Sim;
|
||||||
using DryIoc;
|
using DryIoc;
|
||||||
using Module = ConsoleApp.Module;
|
|
||||||
|
|
||||||
namespace Final
|
namespace ConsoleApp
|
||||||
{
|
{
|
||||||
public class CoreModule : Module
|
public class CoreModule : IModule
|
||||||
{
|
{
|
||||||
public virtual void Register(IContainer container, ExecutionContext executionContext)
|
public virtual void Register(IContainer container)
|
||||||
{
|
{
|
||||||
//container.Register<IUserConsole, UserConsole>(Reuse.Singleton);
|
container.Register<IMapFactory, MapFactory>(Reuse.Singleton);
|
||||||
|
container.Register<ISimRunner, SimRunner>(Reuse.Singleton);
|
||||||
|
container.Register<IVehicle, Vehicle>(Reuse.Singleton);
|
||||||
|
container.Register<IJsonDeserializor, JsonDeserializor>(Reuse.Singleton);
|
||||||
|
container.Register<IPathPlanner, PathPlanner>(Reuse.Singleton);
|
||||||
|
container.Register<IReactivePathPlanner, ReactivePathPlanner>(Reuse.Singleton);
|
||||||
|
container.Register<ISimulationResults, SimulationResults>(Reuse.Singleton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public virtual void Resolve(IContainer container)
|
public virtual void Resolve(IContainer container)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
39
ConsoleApp/HexPlot.py
Normal file
39
ConsoleApp/HexPlot.py
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import numpy as np
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import matplotlib
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
xc = []
|
||||||
|
yc = []
|
||||||
|
xm = []
|
||||||
|
ym = []
|
||||||
|
xf = []
|
||||||
|
yf = []
|
||||||
|
with open("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/HexPath.txt") as c:
|
||||||
|
for line in c:
|
||||||
|
x, y = line.split()
|
||||||
|
xc.append(int(x))
|
||||||
|
yc.append(int(y))
|
||||||
|
|
||||||
|
with open("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/Mines.txt") as m:
|
||||||
|
for line in m:
|
||||||
|
x, y = line.split()
|
||||||
|
xm.append(int(x))
|
||||||
|
ym.append(int(y))
|
||||||
|
|
||||||
|
with open("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/HexDetectedMines.txt") as f:
|
||||||
|
for line in f:
|
||||||
|
x, y = line.split()
|
||||||
|
xf.append(int(x))
|
||||||
|
yf.append(int(y))
|
||||||
|
fig = plt.figure()
|
||||||
|
plt.plot(xc, yc)
|
||||||
|
plt.plot(xc, yc, 'o', label='vehicle', color='blue')
|
||||||
|
plt.plot(xm, ym, 'o', label='all mines', color='red')
|
||||||
|
plt.plot(xf, yf, 'o', label='detected mines', color='orange')
|
||||||
|
plt.title('Hex Simulation')
|
||||||
|
plt.legend(loc='lower left', fontsize='xx-small')
|
||||||
|
|
||||||
|
matplotlib.pyplot.savefig('/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/HexTest.png')
|
||||||
|
plt.close(fig)
|
||||||
7
ConsoleApp/IJsonDeserializor.cs
Normal file
7
ConsoleApp/IJsonDeserializor.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
namespace ConsoleApp
|
||||||
|
{
|
||||||
|
public interface IJsonDeserializor
|
||||||
|
{
|
||||||
|
T DeserializeObject<T>(string filePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
19
ConsoleApp/ISimulationResults.cs
Normal file
19
ConsoleApp/ISimulationResults.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using ConsoleApp.Maps;
|
||||||
|
using HexCore;
|
||||||
|
|
||||||
|
namespace ConsoleApp
|
||||||
|
{
|
||||||
|
public interface ISimulationResults
|
||||||
|
{
|
||||||
|
void WriteResults();
|
||||||
|
int HexTotalMoves { get; set; }
|
||||||
|
int HexBombsFound { get; set; }
|
||||||
|
int TotalBombs { get; set; }
|
||||||
|
List<Coordinate2D> HexPath { get; set; }
|
||||||
|
List<Coordinate2D> HexMappedBombs { get; set; }
|
||||||
|
List<Cell> Mines { get; set; }
|
||||||
|
int HexClearedCells { get; set; }
|
||||||
|
int HexUnClearedCells { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
15
ConsoleApp/JsonDeserializor.cs
Normal file
15
ConsoleApp/JsonDeserializor.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
|
namespace ConsoleApp
|
||||||
|
{
|
||||||
|
public class JsonDeserializor : IJsonDeserializor
|
||||||
|
{
|
||||||
|
public T DeserializeObject<T>(string filePath)
|
||||||
|
{
|
||||||
|
var jString = File.ReadAllText(filePath);
|
||||||
|
return JsonSerializer.Deserialize<T>(jString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
25
ConsoleApp/Maps/Cell.cs
Normal file
25
ConsoleApp/Maps/Cell.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ConsoleApp.Maps
|
||||||
|
{
|
||||||
|
public enum Coverage
|
||||||
|
{
|
||||||
|
Uncoverd,
|
||||||
|
Covered
|
||||||
|
}
|
||||||
|
public struct Cell : ICell
|
||||||
|
{
|
||||||
|
public int X { get; }
|
||||||
|
public int Y { get; }
|
||||||
|
public Coverage Coverage { get; set; }
|
||||||
|
|
||||||
|
public Cell(int x, int y)
|
||||||
|
{
|
||||||
|
X = x;
|
||||||
|
Y = y;
|
||||||
|
Coverage = Coverage.Uncoverd;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
14
ConsoleApp/Maps/GlobalDirection.cs
Normal file
14
ConsoleApp/Maps/GlobalDirection.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
namespace ConsoleApp.Maps
|
||||||
|
{
|
||||||
|
public enum GlobalDirection
|
||||||
|
{
|
||||||
|
North,
|
||||||
|
South,
|
||||||
|
East,
|
||||||
|
West,
|
||||||
|
NorthEast,
|
||||||
|
SouthEast,
|
||||||
|
NorthWest,
|
||||||
|
SouthWest
|
||||||
|
}
|
||||||
|
}
|
||||||
50
ConsoleApp/Maps/Heading.cs
Normal file
50
ConsoleApp/Maps/Heading.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
namespace ConsoleApp.Maps
|
||||||
|
{
|
||||||
|
public class Oreientation
|
||||||
|
{
|
||||||
|
public static (int, int) Forward = (0, 1);
|
||||||
|
public static (int, int) Backward = (0, -1);
|
||||||
|
public static (int, int) Left = (-1, 0);
|
||||||
|
public static (int, int) Right = (1, 0);
|
||||||
|
public static (int, int) LeftBack = (-1, -1);
|
||||||
|
public static (int, int) LeftForward = (-1, 1);
|
||||||
|
public static (int, int) RightBack = (1, -1);
|
||||||
|
public static (int, int) RightForward = (1, 1);
|
||||||
|
}
|
||||||
|
public class Heading
|
||||||
|
{
|
||||||
|
private (int, int) _currentHeading;
|
||||||
|
public (int, int) CurrentHeading { get; }
|
||||||
|
|
||||||
|
|
||||||
|
public void SetHeading((int,int)frontAxel, (int,int)backAxel)
|
||||||
|
{
|
||||||
|
var x = frontAxel.Item1 - backAxel.Item1;
|
||||||
|
var y = frontAxel.Item2 - backAxel.Item2;
|
||||||
|
//forward
|
||||||
|
if (x == 0 && y >= 1) _currentHeading = Oreientation.Forward;
|
||||||
|
//backward
|
||||||
|
if (x == 0 && y <= -1) _currentHeading = Oreientation.Backward;
|
||||||
|
//right
|
||||||
|
if (x >= 1 && y == 0) _currentHeading = Oreientation.Right;
|
||||||
|
//left
|
||||||
|
if (x <= -1 && y == 0) _currentHeading = Oreientation.Left;
|
||||||
|
//left, back
|
||||||
|
if (x <= -1 && y <= -1) _currentHeading = Oreientation.LeftBack;
|
||||||
|
//right, forward
|
||||||
|
if (x >= 1 && y >= 1) _currentHeading = Oreientation.RightForward;
|
||||||
|
//left, forward
|
||||||
|
if (x <= -1 && y >= 1) _currentHeading = Oreientation.LeftForward;
|
||||||
|
//right, back
|
||||||
|
if (x >= 1 && y <= -1) _currentHeading = Oreientation.RightBack;
|
||||||
|
|
||||||
|
}
|
||||||
|
public Heading()
|
||||||
|
{
|
||||||
|
_currentHeading = Oreientation.Forward;
|
||||||
|
CurrentHeading = _currentHeading;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
namespace ConsoleApp
|
|
||||||
{
|
|
||||||
public class HexCell
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,58 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using HexCore;
|
||||||
|
using ImTools;
|
||||||
|
|
||||||
namespace ConsoleApp.Maps
|
namespace ConsoleApp.Maps
|
||||||
{
|
{
|
||||||
public class HexMap
|
public class HexMap : IHexMap
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public int Width { get; }
|
||||||
|
|
||||||
|
public int Height { get; }
|
||||||
|
|
||||||
|
public Graph Graph { get; }
|
||||||
|
|
||||||
|
public OffsetTypes OffsetType { get; }
|
||||||
|
public MovementType DefaultMovement { get; }
|
||||||
|
public TerrainType ClearedTerrain { get; }
|
||||||
|
|
||||||
|
public TerrainType UnclearedTerrain { get; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generate Hex map with cells of 25cm X 25cm
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x"></param>
|
||||||
|
/// <param name="y"></param>
|
||||||
|
public HexMap(int x, int y)
|
||||||
|
{
|
||||||
|
//Set Offset Type for 2d -> 3d conversion
|
||||||
|
OffsetType = OffsetTypes.OddRowsRight;
|
||||||
|
|
||||||
|
Height = y;
|
||||||
|
Width = x;
|
||||||
|
|
||||||
|
UnclearedTerrain = new TerrainType(1, "uncleared");
|
||||||
|
ClearedTerrain = new TerrainType(2, "cleared");
|
||||||
|
|
||||||
|
DefaultMovement = new MovementType(1, "default");
|
||||||
|
var movementTypes = new MovementTypes(
|
||||||
|
new ITerrainType[] { UnclearedTerrain, ClearedTerrain },
|
||||||
|
new Dictionary<IMovementType, Dictionary<ITerrainType, int>>
|
||||||
|
{
|
||||||
|
[DefaultMovement] = new Dictionary<ITerrainType, int>
|
||||||
|
{
|
||||||
|
[UnclearedTerrain] = 1,
|
||||||
|
[ClearedTerrain] = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
Graph = GraphFactory.CreateRectangularGraph(Width, Height, movementTypes, UnclearedTerrain);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
9
ConsoleApp/Maps/ICell.cs
Normal file
9
ConsoleApp/Maps/ICell.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace ConsoleApp.Maps
|
||||||
|
{
|
||||||
|
public interface ICell
|
||||||
|
{
|
||||||
|
int X { get; }
|
||||||
|
int Y { get; }
|
||||||
|
Coverage Coverage { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
namespace ConsoleApp.Maps
|
|
||||||
{
|
|
||||||
public interface IHexCell
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,15 @@
|
|||||||
|
using HexCore;
|
||||||
|
|
||||||
namespace ConsoleApp.Maps
|
namespace ConsoleApp.Maps
|
||||||
{
|
{
|
||||||
public interface IHexMap
|
public interface IHexMap
|
||||||
{
|
{
|
||||||
|
Graph Graph { get; }
|
||||||
|
OffsetTypes OffsetType { get; }
|
||||||
|
int Width { get; }
|
||||||
|
int Height { get; }
|
||||||
|
MovementType DefaultMovement { get; }
|
||||||
|
public TerrainType ClearedTerrain { get; }
|
||||||
|
public TerrainType UnclearedTerrain { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
using System.Dynamic;
|
using System.Dynamic;
|
||||||
|
|
||||||
namespace ConsoleApp.Maps
|
namespace ConsoleApp.Maps
|
||||||
@@ -6,7 +7,9 @@ namespace ConsoleApp.Maps
|
|||||||
{
|
{
|
||||||
int Height { get; }
|
int Height { get; }
|
||||||
int Width { get; }
|
int Width { get; }
|
||||||
SquareMap SquareMap { get; }
|
void GenerateMaps(int x, int y, double minePercentage);
|
||||||
void GenerateMaps(int x, int y);
|
IHexMap GetHexMap();
|
||||||
|
ISquareMap GetSquareMap();
|
||||||
|
IMineMap GetMineMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
13
ConsoleApp/Maps/IMineMap.cs
Normal file
13
ConsoleApp/Maps/IMineMap.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace ConsoleApp.Maps
|
||||||
|
{
|
||||||
|
public interface IMineMap
|
||||||
|
{
|
||||||
|
bool[,] Map { get; }
|
||||||
|
|
||||||
|
int TotalBombs { get; }
|
||||||
|
bool GetCell(int x, int y);
|
||||||
|
List<Cell> PlacedMines { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
namespace ConsoleApp.Maps
|
|
||||||
{
|
|
||||||
public interface ISquareCell
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,17 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using HexCore;
|
||||||
|
|
||||||
namespace ConsoleApp.Maps
|
namespace ConsoleApp.Maps
|
||||||
{
|
{
|
||||||
public interface ISquareMap
|
public interface ISquareMap
|
||||||
{
|
{
|
||||||
|
Cell[,] Map { get; }
|
||||||
|
Cell StartingCell { get; }
|
||||||
|
Cell LastCell { get; }
|
||||||
|
List<GlobalDirection> PossibleMoves(ICell currentCell);
|
||||||
|
Cell GetCell(int x, int y);
|
||||||
|
int Height { get; }
|
||||||
|
int Width { get; }
|
||||||
|
List<Cell> GetRange(Cell centerCell, int radius);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
19
ConsoleApp/Maps/MapExtensions.cs
Normal file
19
ConsoleApp/Maps/MapExtensions.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
namespace ConsoleApp.Maps
|
||||||
|
{
|
||||||
|
public static class MapExtensions
|
||||||
|
{
|
||||||
|
public static void Fill2DArray<T>(this T[,] arr, T value)
|
||||||
|
{
|
||||||
|
int numRows = arr.GetLength(0);
|
||||||
|
int numCols = arr.GetLength(1);
|
||||||
|
|
||||||
|
for (int i = 0; i < numRows; ++i)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < numCols; ++j)
|
||||||
|
{
|
||||||
|
arr[i, j] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using ConsoleApp.Sim;
|
||||||
|
|
||||||
namespace ConsoleApp.Maps
|
namespace ConsoleApp.Maps
|
||||||
{
|
{
|
||||||
public class MapFactory : IMapFactory
|
public class MapFactory : IMapFactory
|
||||||
@@ -6,23 +10,41 @@ namespace ConsoleApp.Maps
|
|||||||
private int _defaultWidth;
|
private int _defaultWidth;
|
||||||
public int Height { get; protected set; }
|
public int Height { get; protected set; }
|
||||||
public int Width { get; protected set; }
|
public int Width { get; protected set; }
|
||||||
public SquareMap SquareMap { get; }
|
|
||||||
public HexMap HexMap { get; }
|
|
||||||
|
|
||||||
|
|
||||||
public void GenerateMaps(int x, int y)
|
|
||||||
|
private ISquareMap _squareMap;
|
||||||
|
|
||||||
|
private IHexMap _hexMap;
|
||||||
|
|
||||||
|
private IMineMap _mineMap;
|
||||||
|
|
||||||
|
public void GenerateMaps(int x, int y, double minePercentage)
|
||||||
{
|
{
|
||||||
Width = x;
|
//convert to cm
|
||||||
Height = y;
|
x *= 100;
|
||||||
throw new System.NotImplementedException();
|
y *= 100;
|
||||||
|
//calculate number of cells on x and y axis
|
||||||
|
var xCellCount = (int)Math.Ceiling((decimal) (x) / 25);
|
||||||
|
var yCellCount = (int)Math.Ceiling((decimal) (y) / 25);
|
||||||
|
Width = xCellCount;
|
||||||
|
Height = yCellCount;
|
||||||
|
_squareMap = new SquareMap(xCellCount, yCellCount);
|
||||||
|
_hexMap = new HexMap(xCellCount, yCellCount);
|
||||||
|
_mineMap = new MineMap(xCellCount, yCellCount, minePercentage);
|
||||||
}
|
}
|
||||||
|
public IHexMap GetHexMap() => _hexMap ?? throw new NullReferenceException("hex map not initialized");
|
||||||
|
public ISquareMap GetSquareMap() => _squareMap ?? throw new NullReferenceException("square map not initialized");
|
||||||
|
public IMineMap GetMineMap() => _mineMap ?? throw new NullReferenceException("mine map not initialized");
|
||||||
|
|
||||||
public MapFactory()
|
public MapFactory(IVehicle vehicle)
|
||||||
{
|
{
|
||||||
_defaultHeight = 0;
|
_defaultHeight = 0;
|
||||||
_defaultWidth = 0;
|
_defaultWidth = 0;
|
||||||
Height = _defaultHeight;
|
Height = _defaultHeight;
|
||||||
Width = _defaultWidth;
|
Width = _defaultWidth;
|
||||||
|
_hexMap = default;
|
||||||
|
_squareMap = default;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
51
ConsoleApp/Maps/MineMap.cs
Normal file
51
ConsoleApp/Maps/MineMap.cs
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using HexCore;
|
||||||
|
|
||||||
|
namespace ConsoleApp.Maps
|
||||||
|
{
|
||||||
|
public class MineMap : IMineMap
|
||||||
|
{
|
||||||
|
private int _mineCount;
|
||||||
|
private int _x;
|
||||||
|
private int _y;
|
||||||
|
public bool[,] Map { get; }
|
||||||
|
public int TotalBombs { get; }
|
||||||
|
public List<Cell> PlacedMines { get; }
|
||||||
|
|
||||||
|
public MineMap(int x, int y, double minePercentage)
|
||||||
|
{
|
||||||
|
_x = x;
|
||||||
|
_y = y;
|
||||||
|
PlacedMines = new List<Cell>();
|
||||||
|
_mineCount = (int)(x*y*(minePercentage/100));
|
||||||
|
TotalBombs = _mineCount;
|
||||||
|
Map = new bool[x, y];
|
||||||
|
Map.Fill2DArray(false);
|
||||||
|
PlaceMines();
|
||||||
|
|
||||||
|
}
|
||||||
|
public bool GetCell(int x, int y) => Map[x,y];
|
||||||
|
|
||||||
|
|
||||||
|
private void PlaceMines()
|
||||||
|
{
|
||||||
|
var rand = new Random();
|
||||||
|
for (var i = 0; i < _mineCount; i++)
|
||||||
|
{
|
||||||
|
var x = rand.Next(5,_x-5);
|
||||||
|
var y = rand.Next(5,_y-5);
|
||||||
|
if (Map[x, y] == true)
|
||||||
|
{
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Map[x, y] = true;
|
||||||
|
PlacedMines.Add(new Cell(x,y));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
namespace ConsoleApp.Maps
|
|
||||||
{
|
|
||||||
public class SquareCell
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,106 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
|
||||||
namespace ConsoleApp.Maps
|
namespace ConsoleApp.Maps
|
||||||
{
|
{
|
||||||
public class SquareMap
|
public class SquareMap : ISquareMap
|
||||||
{
|
{
|
||||||
|
public Cell[,] Map { get;}
|
||||||
|
public Cell StartingCell { get; }
|
||||||
|
public Cell LastCell { get; }
|
||||||
|
public int Height { get; }
|
||||||
|
public int Width { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a map with square cells
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="x"></param>
|
||||||
|
/// <param name="y"></param>
|
||||||
|
public SquareMap(int x, int y)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
//set Width and height Properties
|
||||||
|
Width = x-1;
|
||||||
|
Height = y-1;
|
||||||
|
|
||||||
|
|
||||||
|
//Initialize Map
|
||||||
|
Map = new Cell[x, y];
|
||||||
|
|
||||||
|
//set last cell;
|
||||||
|
StartingCell = Map[0, 0];
|
||||||
|
for (int i = 0; i < x; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < y; j++)
|
||||||
|
{
|
||||||
|
Map[i,j] = new Cell(i, j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<GlobalDirection> PossibleMoves(ICell currentCell)
|
||||||
|
{
|
||||||
|
|
||||||
|
var possibles = new List<GlobalDirection>();
|
||||||
|
if (currentCell.X != 0)
|
||||||
|
possibles.Add(GlobalDirection.West);
|
||||||
|
if (currentCell.X != Width)
|
||||||
|
possibles.Add(GlobalDirection.East);
|
||||||
|
if (currentCell.Y != Height)
|
||||||
|
possibles.Add(GlobalDirection.North);
|
||||||
|
if (currentCell.Y != 0)
|
||||||
|
possibles.Add(GlobalDirection.South);
|
||||||
|
|
||||||
|
return possibles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Cell> GetRange(Cell centerCell, int radius)
|
||||||
|
{
|
||||||
|
var inRange = new List<Cell>();
|
||||||
|
var cx = centerCell.X;
|
||||||
|
var cy = centerCell.Y;
|
||||||
|
var topLeft = GetTopCellInBoundingBox(cx, cy, radius);
|
||||||
|
var bottomRight = GetBottomCellInBoundingBox(cx, cy, radius);
|
||||||
|
for (var i = topLeft.X; i < bottomRight.X; i++)
|
||||||
|
{
|
||||||
|
for (var j = bottomRight.Y; j < topLeft.Y; j++)
|
||||||
|
{
|
||||||
|
if (Math.Pow(i - cx, 2) + Math.Pow(j - cy, 2) < Math.Pow(radius,2))
|
||||||
|
{
|
||||||
|
inRange.Add(Map[i,j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return inRange;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Cell GetTopCellInBoundingBox(int cx, int cy, int radius)
|
||||||
|
{
|
||||||
|
int topX, topY;
|
||||||
|
if (cy + radius > Height) topY = Height;
|
||||||
|
else
|
||||||
|
topY = cy + radius;
|
||||||
|
if (cx - radius < 0) topX = 0;
|
||||||
|
else
|
||||||
|
topX = cx - radius;
|
||||||
|
return Map[topX, topY];
|
||||||
|
}
|
||||||
|
private Cell GetBottomCellInBoundingBox(int cx, int cy, int radius)
|
||||||
|
{
|
||||||
|
int bottomX, bottomY;
|
||||||
|
if (cy - radius > 0) bottomY = 0;
|
||||||
|
else
|
||||||
|
bottomY = cy - radius;
|
||||||
|
if (cx + radius < Width) bottomX = Width;
|
||||||
|
else
|
||||||
|
bottomX = cx + radius;
|
||||||
|
return Map[bottomX, bottomY];
|
||||||
|
}
|
||||||
|
|
||||||
|
public Cell GetCell(int x, int y) => Map[x, y];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
using DryIoc;
|
|
||||||
|
|
||||||
namespace ConsoleApp
|
|
||||||
{
|
|
||||||
public abstract class Module : IModule
|
|
||||||
{
|
|
||||||
public virtual void Register(IContainer container)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void Resolve(IContainer container)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
7
ConsoleApp/Output/Data.txt
Normal file
7
ConsoleApp/Output/Data.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
General:
|
||||||
|
Total Mines: 23
|
||||||
|
Hex:
|
||||||
|
Total Moves: 927
|
||||||
|
Bombs Found: 23
|
||||||
|
Cleared Cell Count: 2295
|
||||||
|
Uncleared Cell Count: 9
|
||||||
0
ConsoleApp/Output/HexDetectedMines.txt
Normal file
0
ConsoleApp/Output/HexDetectedMines.txt
Normal file
927
ConsoleApp/Output/HexPath.txt
Normal file
927
ConsoleApp/Output/HexPath.txt
Normal file
@@ -0,0 +1,927 @@
|
|||||||
|
0 0
|
||||||
|
1 0
|
||||||
|
2 0
|
||||||
|
3 0
|
||||||
|
4 0
|
||||||
|
5 0
|
||||||
|
6 0
|
||||||
|
7 0
|
||||||
|
8 0
|
||||||
|
9 0
|
||||||
|
10 0
|
||||||
|
11 0
|
||||||
|
12 0
|
||||||
|
13 0
|
||||||
|
14 0
|
||||||
|
15 0
|
||||||
|
16 0
|
||||||
|
17 0
|
||||||
|
18 0
|
||||||
|
19 0
|
||||||
|
20 0
|
||||||
|
21 0
|
||||||
|
22 0
|
||||||
|
23 0
|
||||||
|
24 0
|
||||||
|
25 0
|
||||||
|
26 0
|
||||||
|
27 0
|
||||||
|
28 0
|
||||||
|
29 0
|
||||||
|
30 0
|
||||||
|
31 0
|
||||||
|
32 0
|
||||||
|
33 0
|
||||||
|
34 0
|
||||||
|
35 0
|
||||||
|
36 0
|
||||||
|
37 0
|
||||||
|
38 0
|
||||||
|
39 0
|
||||||
|
40 0
|
||||||
|
41 0
|
||||||
|
42 0
|
||||||
|
43 0
|
||||||
|
44 0
|
||||||
|
45 0
|
||||||
|
46 0
|
||||||
|
47 0
|
||||||
|
47 1
|
||||||
|
47 2
|
||||||
|
47 3
|
||||||
|
46 3
|
||||||
|
45 3
|
||||||
|
44 3
|
||||||
|
43 3
|
||||||
|
42 3
|
||||||
|
41 3
|
||||||
|
40 3
|
||||||
|
39 3
|
||||||
|
38 3
|
||||||
|
37 3
|
||||||
|
36 3
|
||||||
|
35 3
|
||||||
|
34 3
|
||||||
|
33 3
|
||||||
|
32 3
|
||||||
|
31 3
|
||||||
|
30 3
|
||||||
|
29 3
|
||||||
|
28 3
|
||||||
|
27 3
|
||||||
|
26 3
|
||||||
|
25 3
|
||||||
|
24 3
|
||||||
|
23 3
|
||||||
|
22 3
|
||||||
|
21 3
|
||||||
|
20 3
|
||||||
|
19 3
|
||||||
|
18 3
|
||||||
|
17 3
|
||||||
|
16 3
|
||||||
|
15 3
|
||||||
|
14 3
|
||||||
|
13 3
|
||||||
|
12 3
|
||||||
|
11 3
|
||||||
|
10 3
|
||||||
|
9 3
|
||||||
|
8 3
|
||||||
|
7 3
|
||||||
|
6 3
|
||||||
|
5 3
|
||||||
|
4 3
|
||||||
|
3 3
|
||||||
|
2 3
|
||||||
|
1 3
|
||||||
|
0 3
|
||||||
|
1 4
|
||||||
|
0 5
|
||||||
|
0 6
|
||||||
|
1 6
|
||||||
|
2 6
|
||||||
|
3 6
|
||||||
|
4 6
|
||||||
|
5 6
|
||||||
|
6 6
|
||||||
|
7 6
|
||||||
|
6 5
|
||||||
|
7 4
|
||||||
|
8 4
|
||||||
|
9 4
|
||||||
|
10 4
|
||||||
|
10 5
|
||||||
|
11 6
|
||||||
|
12 6
|
||||||
|
13 6
|
||||||
|
14 6
|
||||||
|
15 6
|
||||||
|
16 6
|
||||||
|
17 6
|
||||||
|
18 6
|
||||||
|
19 6
|
||||||
|
20 6
|
||||||
|
21 6
|
||||||
|
20 5
|
||||||
|
21 4
|
||||||
|
22 4
|
||||||
|
23 4
|
||||||
|
24 4
|
||||||
|
24 5
|
||||||
|
25 6
|
||||||
|
26 6
|
||||||
|
27 6
|
||||||
|
28 6
|
||||||
|
29 6
|
||||||
|
30 6
|
||||||
|
31 6
|
||||||
|
32 6
|
||||||
|
33 6
|
||||||
|
34 6
|
||||||
|
35 6
|
||||||
|
36 6
|
||||||
|
37 6
|
||||||
|
38 6
|
||||||
|
39 6
|
||||||
|
40 6
|
||||||
|
41 6
|
||||||
|
42 6
|
||||||
|
43 6
|
||||||
|
44 6
|
||||||
|
45 6
|
||||||
|
46 6
|
||||||
|
47 6
|
||||||
|
47 7
|
||||||
|
47 8
|
||||||
|
47 9
|
||||||
|
46 9
|
||||||
|
45 9
|
||||||
|
44 9
|
||||||
|
43 9
|
||||||
|
42 9
|
||||||
|
41 9
|
||||||
|
40 9
|
||||||
|
39 9
|
||||||
|
38 9
|
||||||
|
37 9
|
||||||
|
36 9
|
||||||
|
35 9
|
||||||
|
34 9
|
||||||
|
33 9
|
||||||
|
32 9
|
||||||
|
31 9
|
||||||
|
30 9
|
||||||
|
29 9
|
||||||
|
28 9
|
||||||
|
27 9
|
||||||
|
27 8
|
||||||
|
26 8
|
||||||
|
25 8
|
||||||
|
24 9
|
||||||
|
24 9
|
||||||
|
24 10
|
||||||
|
23 10
|
||||||
|
23 11
|
||||||
|
23 12
|
||||||
|
22 12
|
||||||
|
21 12
|
||||||
|
20 12
|
||||||
|
19 11
|
||||||
|
19 10
|
||||||
|
18 9
|
||||||
|
17 9
|
||||||
|
16 9
|
||||||
|
15 9
|
||||||
|
14 9
|
||||||
|
13 9
|
||||||
|
12 9
|
||||||
|
12 9
|
||||||
|
13 10
|
||||||
|
12 11
|
||||||
|
12 12
|
||||||
|
13 12
|
||||||
|
13 13
|
||||||
|
13 14
|
||||||
|
12 15
|
||||||
|
12 16
|
||||||
|
11 16
|
||||||
|
10 16
|
||||||
|
9 16
|
||||||
|
8 15
|
||||||
|
8 14
|
||||||
|
7 13
|
||||||
|
7 12
|
||||||
|
6 11
|
||||||
|
6 10
|
||||||
|
5 9
|
||||||
|
4 9
|
||||||
|
3 9
|
||||||
|
2 9
|
||||||
|
1 9
|
||||||
|
0 9
|
||||||
|
1 10
|
||||||
|
0 11
|
||||||
|
0 12
|
||||||
|
1 12
|
||||||
|
2 12
|
||||||
|
3 12
|
||||||
|
4 12
|
||||||
|
5 12
|
||||||
|
6 12
|
||||||
|
7 12
|
||||||
|
8 12
|
||||||
|
8 12
|
||||||
|
7 13
|
||||||
|
8 14
|
||||||
|
8 15
|
||||||
|
9 16
|
||||||
|
10 16
|
||||||
|
11 16
|
||||||
|
12 16
|
||||||
|
12 15
|
||||||
|
13 14
|
||||||
|
13 13
|
||||||
|
13 12
|
||||||
|
14 12
|
||||||
|
15 12
|
||||||
|
16 12
|
||||||
|
17 12
|
||||||
|
18 12
|
||||||
|
19 12
|
||||||
|
20 12
|
||||||
|
21 12
|
||||||
|
22 12
|
||||||
|
22 12
|
||||||
|
21 13
|
||||||
|
21 14
|
||||||
|
20 13
|
||||||
|
19 13
|
||||||
|
19 14
|
||||||
|
18 15
|
||||||
|
18 16
|
||||||
|
18 17
|
||||||
|
19 18
|
||||||
|
19 19
|
||||||
|
20 19
|
||||||
|
21 19
|
||||||
|
22 19
|
||||||
|
23 18
|
||||||
|
23 17
|
||||||
|
23 18
|
||||||
|
23 19
|
||||||
|
24 19
|
||||||
|
25 19
|
||||||
|
26 19
|
||||||
|
27 18
|
||||||
|
27 17
|
||||||
|
28 16
|
||||||
|
28 15
|
||||||
|
29 14
|
||||||
|
29 13
|
||||||
|
30 12
|
||||||
|
31 12
|
||||||
|
32 12
|
||||||
|
33 12
|
||||||
|
34 12
|
||||||
|
35 12
|
||||||
|
36 12
|
||||||
|
37 12
|
||||||
|
38 12
|
||||||
|
39 12
|
||||||
|
40 12
|
||||||
|
41 12
|
||||||
|
42 12
|
||||||
|
43 12
|
||||||
|
44 12
|
||||||
|
45 12
|
||||||
|
46 12
|
||||||
|
47 12
|
||||||
|
47 13
|
||||||
|
47 14
|
||||||
|
47 15
|
||||||
|
46 15
|
||||||
|
45 15
|
||||||
|
44 15
|
||||||
|
43 15
|
||||||
|
42 15
|
||||||
|
41 15
|
||||||
|
41 14
|
||||||
|
40 14
|
||||||
|
39 14
|
||||||
|
38 15
|
||||||
|
37 15
|
||||||
|
36 15
|
||||||
|
35 15
|
||||||
|
34 15
|
||||||
|
33 15
|
||||||
|
32 15
|
||||||
|
31 15
|
||||||
|
30 15
|
||||||
|
29 15
|
||||||
|
28 15
|
||||||
|
27 15
|
||||||
|
27 15
|
||||||
|
28 16
|
||||||
|
27 17
|
||||||
|
27 18
|
||||||
|
26 19
|
||||||
|
25 19
|
||||||
|
24 19
|
||||||
|
23 19
|
||||||
|
22 19
|
||||||
|
21 19
|
||||||
|
20 19
|
||||||
|
19 19
|
||||||
|
19 18
|
||||||
|
18 17
|
||||||
|
18 16
|
||||||
|
18 15
|
||||||
|
17 15
|
||||||
|
16 15
|
||||||
|
15 15
|
||||||
|
14 15
|
||||||
|
13 15
|
||||||
|
12 15
|
||||||
|
12 15
|
||||||
|
12 16
|
||||||
|
11 16
|
||||||
|
10 16
|
||||||
|
9 16
|
||||||
|
8 15
|
||||||
|
7 15
|
||||||
|
6 15
|
||||||
|
5 15
|
||||||
|
4 15
|
||||||
|
3 15
|
||||||
|
2 15
|
||||||
|
1 15
|
||||||
|
0 15
|
||||||
|
1 16
|
||||||
|
0 17
|
||||||
|
0 18
|
||||||
|
1 18
|
||||||
|
2 18
|
||||||
|
3 18
|
||||||
|
4 18
|
||||||
|
5 18
|
||||||
|
6 18
|
||||||
|
5 17
|
||||||
|
6 16
|
||||||
|
7 16
|
||||||
|
8 16
|
||||||
|
9 16
|
||||||
|
9 17
|
||||||
|
10 16
|
||||||
|
11 16
|
||||||
|
12 16
|
||||||
|
12 17
|
||||||
|
13 18
|
||||||
|
14 18
|
||||||
|
15 18
|
||||||
|
16 18
|
||||||
|
17 18
|
||||||
|
18 18
|
||||||
|
19 18
|
||||||
|
19 18
|
||||||
|
19 19
|
||||||
|
20 19
|
||||||
|
21 19
|
||||||
|
22 19
|
||||||
|
23 18
|
||||||
|
23 18
|
||||||
|
23 19
|
||||||
|
24 19
|
||||||
|
25 19
|
||||||
|
26 19
|
||||||
|
27 18
|
||||||
|
28 18
|
||||||
|
29 18
|
||||||
|
30 18
|
||||||
|
31 18
|
||||||
|
32 18
|
||||||
|
33 18
|
||||||
|
34 18
|
||||||
|
35 18
|
||||||
|
36 18
|
||||||
|
37 18
|
||||||
|
38 18
|
||||||
|
38 18
|
||||||
|
38 19
|
||||||
|
39 20
|
||||||
|
40 20
|
||||||
|
41 20
|
||||||
|
42 20
|
||||||
|
42 19
|
||||||
|
43 18
|
||||||
|
44 18
|
||||||
|
45 18
|
||||||
|
46 18
|
||||||
|
47 18
|
||||||
|
47 19
|
||||||
|
47 20
|
||||||
|
47 21
|
||||||
|
46 21
|
||||||
|
45 21
|
||||||
|
44 21
|
||||||
|
43 21
|
||||||
|
42 21
|
||||||
|
41 21
|
||||||
|
40 21
|
||||||
|
39 21
|
||||||
|
38 21
|
||||||
|
37 21
|
||||||
|
36 21
|
||||||
|
36 20
|
||||||
|
35 20
|
||||||
|
34 20
|
||||||
|
33 21
|
||||||
|
32 21
|
||||||
|
31 21
|
||||||
|
30 21
|
||||||
|
29 21
|
||||||
|
28 21
|
||||||
|
27 21
|
||||||
|
26 21
|
||||||
|
25 21
|
||||||
|
24 21
|
||||||
|
23 21
|
||||||
|
22 21
|
||||||
|
21 21
|
||||||
|
20 21
|
||||||
|
19 21
|
||||||
|
18 21
|
||||||
|
17 21
|
||||||
|
16 21
|
||||||
|
15 21
|
||||||
|
14 21
|
||||||
|
13 21
|
||||||
|
12 21
|
||||||
|
12 21
|
||||||
|
12 22
|
||||||
|
11 22
|
||||||
|
10 22
|
||||||
|
9 22
|
||||||
|
8 22
|
||||||
|
7 22
|
||||||
|
6 22
|
||||||
|
5 21
|
||||||
|
4 21
|
||||||
|
3 21
|
||||||
|
2 21
|
||||||
|
1 21
|
||||||
|
0 21
|
||||||
|
1 22
|
||||||
|
0 23
|
||||||
|
0 24
|
||||||
|
1 24
|
||||||
|
2 24
|
||||||
|
3 24
|
||||||
|
4 24
|
||||||
|
5 24
|
||||||
|
6 24
|
||||||
|
7 24
|
||||||
|
6 23
|
||||||
|
7 22
|
||||||
|
8 22
|
||||||
|
9 22
|
||||||
|
10 22
|
||||||
|
10 23
|
||||||
|
11 24
|
||||||
|
12 24
|
||||||
|
13 24
|
||||||
|
14 24
|
||||||
|
15 24
|
||||||
|
16 24
|
||||||
|
17 24
|
||||||
|
18 24
|
||||||
|
19 24
|
||||||
|
20 24
|
||||||
|
21 24
|
||||||
|
22 24
|
||||||
|
23 24
|
||||||
|
24 24
|
||||||
|
25 24
|
||||||
|
26 24
|
||||||
|
27 24
|
||||||
|
28 24
|
||||||
|
29 24
|
||||||
|
30 24
|
||||||
|
31 24
|
||||||
|
32 24
|
||||||
|
31 24
|
||||||
|
30 25
|
||||||
|
30 26
|
||||||
|
30 27
|
||||||
|
31 28
|
||||||
|
31 29
|
||||||
|
32 29
|
||||||
|
33 29
|
||||||
|
34 29
|
||||||
|
35 28
|
||||||
|
35 27
|
||||||
|
36 26
|
||||||
|
37 26
|
||||||
|
37 25
|
||||||
|
38 24
|
||||||
|
39 24
|
||||||
|
40 24
|
||||||
|
41 24
|
||||||
|
42 24
|
||||||
|
43 24
|
||||||
|
44 24
|
||||||
|
45 24
|
||||||
|
46 24
|
||||||
|
47 24
|
||||||
|
47 25
|
||||||
|
47 26
|
||||||
|
47 27
|
||||||
|
46 27
|
||||||
|
45 27
|
||||||
|
44 27
|
||||||
|
43 27
|
||||||
|
42 27
|
||||||
|
41 27
|
||||||
|
40 27
|
||||||
|
39 27
|
||||||
|
38 27
|
||||||
|
37 27
|
||||||
|
36 27
|
||||||
|
35 27
|
||||||
|
35 27
|
||||||
|
35 28
|
||||||
|
34 29
|
||||||
|
33 29
|
||||||
|
32 29
|
||||||
|
31 29
|
||||||
|
31 28
|
||||||
|
30 27
|
||||||
|
29 27
|
||||||
|
28 27
|
||||||
|
27 27
|
||||||
|
26 27
|
||||||
|
25 27
|
||||||
|
24 27
|
||||||
|
23 27
|
||||||
|
22 27
|
||||||
|
21 27
|
||||||
|
20 27
|
||||||
|
19 27
|
||||||
|
18 27
|
||||||
|
17 27
|
||||||
|
16 27
|
||||||
|
15 27
|
||||||
|
14 27
|
||||||
|
13 27
|
||||||
|
12 27
|
||||||
|
11 27
|
||||||
|
12 27
|
||||||
|
13 28
|
||||||
|
12 29
|
||||||
|
12 30
|
||||||
|
11 31
|
||||||
|
10 31
|
||||||
|
9 31
|
||||||
|
8 31
|
||||||
|
8 30
|
||||||
|
7 29
|
||||||
|
7 28
|
||||||
|
6 27
|
||||||
|
5 27
|
||||||
|
4 27
|
||||||
|
3 27
|
||||||
|
2 27
|
||||||
|
1 27
|
||||||
|
0 27
|
||||||
|
1 28
|
||||||
|
0 29
|
||||||
|
0 30
|
||||||
|
1 30
|
||||||
|
2 30
|
||||||
|
3 30
|
||||||
|
4 30
|
||||||
|
5 30
|
||||||
|
5 29
|
||||||
|
6 29
|
||||||
|
7 29
|
||||||
|
8 30
|
||||||
|
8 30
|
||||||
|
8 31
|
||||||
|
9 31
|
||||||
|
10 31
|
||||||
|
11 31
|
||||||
|
12 30
|
||||||
|
13 30
|
||||||
|
14 30
|
||||||
|
15 30
|
||||||
|
16 30
|
||||||
|
17 30
|
||||||
|
18 30
|
||||||
|
18 30
|
||||||
|
17 31
|
||||||
|
18 32
|
||||||
|
18 33
|
||||||
|
19 33
|
||||||
|
20 33
|
||||||
|
21 33
|
||||||
|
22 32
|
||||||
|
22 31
|
||||||
|
23 30
|
||||||
|
24 30
|
||||||
|
25 30
|
||||||
|
26 30
|
||||||
|
27 30
|
||||||
|
28 30
|
||||||
|
29 30
|
||||||
|
30 30
|
||||||
|
31 30
|
||||||
|
32 30
|
||||||
|
33 30
|
||||||
|
34 30
|
||||||
|
35 30
|
||||||
|
36 30
|
||||||
|
37 30
|
||||||
|
38 30
|
||||||
|
39 30
|
||||||
|
40 30
|
||||||
|
41 30
|
||||||
|
42 30
|
||||||
|
43 30
|
||||||
|
44 30
|
||||||
|
45 30
|
||||||
|
46 30
|
||||||
|
47 30
|
||||||
|
47 31
|
||||||
|
47 32
|
||||||
|
47 33
|
||||||
|
46 33
|
||||||
|
45 33
|
||||||
|
44 33
|
||||||
|
43 33
|
||||||
|
42 33
|
||||||
|
41 33
|
||||||
|
40 33
|
||||||
|
39 33
|
||||||
|
40 32
|
||||||
|
39 31
|
||||||
|
38 31
|
||||||
|
37 31
|
||||||
|
36 31
|
||||||
|
36 32
|
||||||
|
35 33
|
||||||
|
34 33
|
||||||
|
33 33
|
||||||
|
32 33
|
||||||
|
31 33
|
||||||
|
30 33
|
||||||
|
29 33
|
||||||
|
28 33
|
||||||
|
27 33
|
||||||
|
26 33
|
||||||
|
25 33
|
||||||
|
24 33
|
||||||
|
23 33
|
||||||
|
22 33
|
||||||
|
21 33
|
||||||
|
20 33
|
||||||
|
19 33
|
||||||
|
18 33
|
||||||
|
17 33
|
||||||
|
16 33
|
||||||
|
15 33
|
||||||
|
14 33
|
||||||
|
13 33
|
||||||
|
12 33
|
||||||
|
11 33
|
||||||
|
10 33
|
||||||
|
9 33
|
||||||
|
8 33
|
||||||
|
8 33
|
||||||
|
8 34
|
||||||
|
7 35
|
||||||
|
6 35
|
||||||
|
5 35
|
||||||
|
4 35
|
||||||
|
4 34
|
||||||
|
3 33
|
||||||
|
2 33
|
||||||
|
1 33
|
||||||
|
0 33
|
||||||
|
1 34
|
||||||
|
0 35
|
||||||
|
0 36
|
||||||
|
1 36
|
||||||
|
2 36
|
||||||
|
3 36
|
||||||
|
4 36
|
||||||
|
5 36
|
||||||
|
6 36
|
||||||
|
7 36
|
||||||
|
8 36
|
||||||
|
9 36
|
||||||
|
10 36
|
||||||
|
11 36
|
||||||
|
12 36
|
||||||
|
13 36
|
||||||
|
14 36
|
||||||
|
15 36
|
||||||
|
16 36
|
||||||
|
17 36
|
||||||
|
18 36
|
||||||
|
18 35
|
||||||
|
19 35
|
||||||
|
19 34
|
||||||
|
19 33
|
||||||
|
20 33
|
||||||
|
21 33
|
||||||
|
22 33
|
||||||
|
23 34
|
||||||
|
23 35
|
||||||
|
24 36
|
||||||
|
25 36
|
||||||
|
26 36
|
||||||
|
27 36
|
||||||
|
28 36
|
||||||
|
29 36
|
||||||
|
29 35
|
||||||
|
30 35
|
||||||
|
31 35
|
||||||
|
32 36
|
||||||
|
33 36
|
||||||
|
34 36
|
||||||
|
35 36
|
||||||
|
36 36
|
||||||
|
36 36
|
||||||
|
36 37
|
||||||
|
37 37
|
||||||
|
38 37
|
||||||
|
39 37
|
||||||
|
40 36
|
||||||
|
41 36
|
||||||
|
42 36
|
||||||
|
43 36
|
||||||
|
44 36
|
||||||
|
45 36
|
||||||
|
46 36
|
||||||
|
47 36
|
||||||
|
47 37
|
||||||
|
47 38
|
||||||
|
47 39
|
||||||
|
46 39
|
||||||
|
45 39
|
||||||
|
44 39
|
||||||
|
43 39
|
||||||
|
42 39
|
||||||
|
41 39
|
||||||
|
40 39
|
||||||
|
39 39
|
||||||
|
38 39
|
||||||
|
38 39
|
||||||
|
38 39
|
||||||
|
38 40
|
||||||
|
37 41
|
||||||
|
37 42
|
||||||
|
36 42
|
||||||
|
35 42
|
||||||
|
34 42
|
||||||
|
33 41
|
||||||
|
33 40
|
||||||
|
32 39
|
||||||
|
32 39
|
||||||
|
32 40
|
||||||
|
31 41
|
||||||
|
30 41
|
||||||
|
29 41
|
||||||
|
28 41
|
||||||
|
28 40
|
||||||
|
27 39
|
||||||
|
26 39
|
||||||
|
25 39
|
||||||
|
24 39
|
||||||
|
23 39
|
||||||
|
22 39
|
||||||
|
21 39
|
||||||
|
21 39
|
||||||
|
21 40
|
||||||
|
20 41
|
||||||
|
19 41
|
||||||
|
18 41
|
||||||
|
17 41
|
||||||
|
17 40
|
||||||
|
16 39
|
||||||
|
15 39
|
||||||
|
14 39
|
||||||
|
13 39
|
||||||
|
12 39
|
||||||
|
11 39
|
||||||
|
10 39
|
||||||
|
9 39
|
||||||
|
8 39
|
||||||
|
7 39
|
||||||
|
6 39
|
||||||
|
5 39
|
||||||
|
4 39
|
||||||
|
3 39
|
||||||
|
2 39
|
||||||
|
1 39
|
||||||
|
0 39
|
||||||
|
1 40
|
||||||
|
0 41
|
||||||
|
0 42
|
||||||
|
1 42
|
||||||
|
2 42
|
||||||
|
3 42
|
||||||
|
4 42
|
||||||
|
5 42
|
||||||
|
6 42
|
||||||
|
7 42
|
||||||
|
8 42
|
||||||
|
9 42
|
||||||
|
10 42
|
||||||
|
11 42
|
||||||
|
12 42
|
||||||
|
13 42
|
||||||
|
14 42
|
||||||
|
15 42
|
||||||
|
16 42
|
||||||
|
17 42
|
||||||
|
18 42
|
||||||
|
19 42
|
||||||
|
20 42
|
||||||
|
21 42
|
||||||
|
22 42
|
||||||
|
23 42
|
||||||
|
24 42
|
||||||
|
25 42
|
||||||
|
26 42
|
||||||
|
27 42
|
||||||
|
28 42
|
||||||
|
29 42
|
||||||
|
30 42
|
||||||
|
31 42
|
||||||
|
32 42
|
||||||
|
33 42
|
||||||
|
34 42
|
||||||
|
35 42
|
||||||
|
36 42
|
||||||
|
37 42
|
||||||
|
38 42
|
||||||
|
39 42
|
||||||
|
40 42
|
||||||
|
41 42
|
||||||
|
42 42
|
||||||
|
43 42
|
||||||
|
44 42
|
||||||
|
45 42
|
||||||
|
46 42
|
||||||
|
47 42
|
||||||
|
47 43
|
||||||
|
47 44
|
||||||
|
47 45
|
||||||
|
46 45
|
||||||
|
45 45
|
||||||
|
44 45
|
||||||
|
43 45
|
||||||
|
42 45
|
||||||
|
41 45
|
||||||
|
40 45
|
||||||
|
39 45
|
||||||
|
38 45
|
||||||
|
37 45
|
||||||
|
36 45
|
||||||
|
35 45
|
||||||
|
34 45
|
||||||
|
33 45
|
||||||
|
32 45
|
||||||
|
31 45
|
||||||
|
30 45
|
||||||
|
29 45
|
||||||
|
28 45
|
||||||
|
27 45
|
||||||
|
26 45
|
||||||
|
25 45
|
||||||
|
24 45
|
||||||
|
23 45
|
||||||
|
22 45
|
||||||
|
21 45
|
||||||
|
20 45
|
||||||
|
19 45
|
||||||
|
18 45
|
||||||
|
17 45
|
||||||
|
16 45
|
||||||
|
15 45
|
||||||
|
14 45
|
||||||
|
13 45
|
||||||
|
12 45
|
||||||
|
11 45
|
||||||
|
10 45
|
||||||
|
9 45
|
||||||
|
8 45
|
||||||
|
7 45
|
||||||
|
6 45
|
||||||
|
5 45
|
||||||
|
4 45
|
||||||
|
3 45
|
||||||
|
2 45
|
||||||
|
1 45
|
||||||
|
0 45
|
||||||
BIN
ConsoleApp/Output/HexTest.png
Normal file
BIN
ConsoleApp/Output/HexTest.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
14
ConsoleApp/PathPlanners/IPathPlanner.cs
Normal file
14
ConsoleApp/PathPlanners/IPathPlanner.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using ConsoleApp.Maps;
|
||||||
|
using ConsoleApp.Sim;
|
||||||
|
using HexCore;
|
||||||
|
|
||||||
|
namespace ConsoleApp.PathPlanners
|
||||||
|
{
|
||||||
|
public interface IPathPlanner
|
||||||
|
{
|
||||||
|
Queue<ICell> GenerateOptimalSquarePath(ISquareMap map, IVehicle vehicle);
|
||||||
|
Queue<Coordinate2D> GenerateOptimalHexPath(IHexMap hexMap, IVehicle vehicle);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
12
ConsoleApp/PathPlanners/IReactivePathPlanner.cs
Normal file
12
ConsoleApp/PathPlanners/IReactivePathPlanner.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using ConsoleApp.Maps;
|
||||||
|
using HexCore;
|
||||||
|
|
||||||
|
namespace ConsoleApp.PathPlanners
|
||||||
|
{
|
||||||
|
public interface IReactivePathPlanner
|
||||||
|
{
|
||||||
|
Queue<Coordinate2D> ReactiveHexPath { get; }
|
||||||
|
void GenerateReactiveHexPath(IHexMap hexMap, Queue<Coordinate2D> optimalPath, Coordinate2D vehicleCurrentHexCell);
|
||||||
|
}
|
||||||
|
}
|
||||||
122
ConsoleApp/PathPlanners/PathPlanner.cs
Normal file
122
ConsoleApp/PathPlanners/PathPlanner.cs
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using ConsoleApp.Maps;
|
||||||
|
using ConsoleApp.Sim;
|
||||||
|
using HexCore;
|
||||||
|
|
||||||
|
namespace ConsoleApp.PathPlanners
|
||||||
|
{
|
||||||
|
public class PathPlanner : IPathPlanner
|
||||||
|
{
|
||||||
|
public Queue<ICell> GenerateOptimalSquarePath(ISquareMap map, IVehicle vehicle)
|
||||||
|
{
|
||||||
|
var path = new Queue<ICell>();
|
||||||
|
var myCell = map.StartingCell;
|
||||||
|
var finished = false;
|
||||||
|
var width_cm = (double)(vehicle.DetectorRadius) * 100 * 2;
|
||||||
|
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.GetCell(myCell.X, myCell.Y + 1));
|
||||||
|
myCell = map.GetCell(myCell.X, myCell.Y + 1);
|
||||||
|
}
|
||||||
|
else if (availableMoves.Contains(GlobalDirection.South) && currentHeading == GlobalDirection.South && myCell.Y != 0)
|
||||||
|
{
|
||||||
|
path.Enqueue(map.GetCell(myCell.X, myCell.Y - 1));
|
||||||
|
myCell = map.GetCell(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.GetCell(i, myCell.Y));
|
||||||
|
}
|
||||||
|
myCell = map.GetCell(myCell.X+swathOffset, myCell.Y);
|
||||||
|
if (currentHeading == GlobalDirection.North)
|
||||||
|
currentHeading = GlobalDirection.South;
|
||||||
|
else if (currentHeading == GlobalDirection.South)
|
||||||
|
currentHeading = GlobalDirection.North;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Queue<Coordinate2D> GenerateOptimalHexPath(IHexMap hexMap, IVehicle vehicle)
|
||||||
|
{
|
||||||
|
var currentPostion = vehicle.CurrentHexCell;
|
||||||
|
var currentHeading = GlobalDirection.East;
|
||||||
|
var finished = false;
|
||||||
|
var path = new List<Coordinate2D>();
|
||||||
|
while (!finished)
|
||||||
|
{
|
||||||
|
//Heading East
|
||||||
|
if (currentHeading == GlobalDirection.East)
|
||||||
|
{
|
||||||
|
path.AddRange(hexMap.Graph.GetShortestPath(
|
||||||
|
currentPostion,
|
||||||
|
new Coordinate2D(hexMap.Width-1, currentPostion.Y, hexMap.OffsetType),
|
||||||
|
hexMap.DefaultMovement));
|
||||||
|
currentPostion = new Coordinate2D(hexMap.Width-1, currentPostion.Y, hexMap.OffsetType);
|
||||||
|
}
|
||||||
|
//Heading West
|
||||||
|
else if (currentHeading == GlobalDirection.West)
|
||||||
|
{
|
||||||
|
path.AddRange(hexMap.Graph.GetShortestPath(
|
||||||
|
currentPostion,
|
||||||
|
new Coordinate2D(0, currentPostion.Y, hexMap.OffsetType),
|
||||||
|
hexMap.DefaultMovement));
|
||||||
|
currentPostion = new Coordinate2D(0, currentPostion.Y, hexMap.OffsetType);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Check for finish
|
||||||
|
if (currentPostion.Y + (vehicle.DetectorRadius * 2) >= hexMap.Height - 1)
|
||||||
|
{
|
||||||
|
finished = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Move Up edges of map
|
||||||
|
var tmpPosition = currentPostion;
|
||||||
|
var range = hexMap.Graph.GetRange(currentPostion, vehicle.DetectorRadius * 2);
|
||||||
|
for (var i = currentPostion.Y; i < currentPostion.Y + vehicle.DetectorRadius * 2; i++)
|
||||||
|
{
|
||||||
|
var newCoord = new Coordinate2D(currentPostion.X, i, hexMap.OffsetType);
|
||||||
|
if (range.Contains(newCoord))
|
||||||
|
tmpPosition = newCoord;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
path.AddRange(hexMap.Graph.GetShortestPath(
|
||||||
|
currentPostion,
|
||||||
|
tmpPosition,
|
||||||
|
hexMap.DefaultMovement));
|
||||||
|
currentPostion = tmpPosition;
|
||||||
|
if (currentHeading == GlobalDirection.East)
|
||||||
|
currentHeading = GlobalDirection.West;
|
||||||
|
else
|
||||||
|
currentHeading = GlobalDirection.East;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Queue<Coordinate2D>(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
44
ConsoleApp/PathPlanners/ReactivePathPlanner.cs
Normal file
44
ConsoleApp/PathPlanners/ReactivePathPlanner.cs
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using ConsoleApp.Maps;
|
||||||
|
using HexCore;
|
||||||
|
|
||||||
|
namespace ConsoleApp.PathPlanners
|
||||||
|
{
|
||||||
|
public class ReactivePathPlanner : IReactivePathPlanner
|
||||||
|
{
|
||||||
|
private Queue<Coordinate2D> _reactiveHexPath;
|
||||||
|
public Queue<Coordinate2D> ReactiveHexPath => _reactiveHexPath;
|
||||||
|
|
||||||
|
|
||||||
|
public ReactivePathPlanner()
|
||||||
|
{
|
||||||
|
_reactiveHexPath = new Queue<Coordinate2D>();
|
||||||
|
}
|
||||||
|
public void GenerateReactiveHexPath(IHexMap hexMap, Queue<Coordinate2D> optimalPath,
|
||||||
|
Coordinate2D vehicleCurrentHexCell)
|
||||||
|
{
|
||||||
|
//Clean out any old path
|
||||||
|
_reactiveHexPath.Clear();
|
||||||
|
|
||||||
|
//If the optimal path is empty well we are done, otherwise pop 1
|
||||||
|
if (!optimalPath.TryDequeue(out var convergentPoint))
|
||||||
|
return;
|
||||||
|
|
||||||
|
//Dequeue until the cell is not blocked
|
||||||
|
while (hexMap.Graph.IsCellBlocked(convergentPoint))
|
||||||
|
{
|
||||||
|
//if optimal path is empty were done and we can not clear around this position, otherwise
|
||||||
|
//lest pop another.
|
||||||
|
if (!optimalPath.TryDequeue(out convergentPoint))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var reactivePath = hexMap.Graph.GetShortestPath(vehicleCurrentHexCell, convergentPoint, hexMap.DefaultMovement);
|
||||||
|
foreach (var node in reactivePath)
|
||||||
|
{
|
||||||
|
_reactiveHexPath.Enqueue(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Threading;
|
||||||
using ConsoleApp.Maps;
|
using ConsoleApp.Maps;
|
||||||
|
|
||||||
namespace ConsoleApp
|
namespace ConsoleApp
|
||||||
@@ -10,33 +14,39 @@ namespace ConsoleApp
|
|||||||
|
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
_bootstrapper = new BootStrapper();
|
_bootstrapper = BootStrapper.BootstrapSystem(new CoreModule());
|
||||||
|
var simResults = _bootstrapper.Resolve<ISimulationResults>();
|
||||||
_userConsole = new UserConsole();
|
_userConsole = new UserConsole();
|
||||||
StartSimulation();
|
Initialization();
|
||||||
|
simResults.WriteResults();
|
||||||
|
Console.WriteLine("Program Completed");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void StartSimulation()
|
|
||||||
|
|
||||||
|
private static void Initialization()
|
||||||
{
|
{
|
||||||
_userConsole.PrintStartMenu();
|
_userConsole.PrintStartMenu();
|
||||||
var input = _userConsole.GetUserInput();
|
var input = UserConsole.GetUserInput();
|
||||||
if (input == "1")
|
if (input == "1")
|
||||||
{
|
{
|
||||||
var (x,y) = _userConsole.GetMapDimensions();
|
var (x,y) = _userConsole.GetMapDimensions();
|
||||||
RunSimulation(x, y);
|
var minePercentage = UserConsole.GetMinePercentage();
|
||||||
|
RunSimulation(x, y, minePercentage);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_userConsole.PrintInvalidInput();
|
UserConsole.PrintInvalidInput();
|
||||||
StartSimulation();
|
Initialization();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RunSimulation(int x,int y)
|
private static void RunSimulation(int x, int y, double minePercentage)
|
||||||
{
|
{
|
||||||
var simRunner = _bootstrapper.Resolve<ISimRunner>();
|
|
||||||
var mapFactory = _bootstrapper.Resolve<IMapFactory>();
|
var mapFactory = _bootstrapper.Resolve<IMapFactory>();
|
||||||
|
var simRunner = _bootstrapper.Resolve<ISimRunner>();
|
||||||
|
|
||||||
mapFactory.GenerateMaps(x, y);
|
mapFactory.GenerateMaps(x, y, minePercentage);
|
||||||
simRunner.Run();
|
simRunner.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
29
ConsoleApp/Sim/DetectionHead.cs
Normal file
29
ConsoleApp/Sim/DetectionHead.cs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using ConsoleApp.Maps;
|
||||||
|
using HexCore;
|
||||||
|
|
||||||
|
namespace ConsoleApp.Sim
|
||||||
|
{
|
||||||
|
public static class DetectionHead
|
||||||
|
{
|
||||||
|
public static List<Coordinate2D> GetCoveredCells(
|
||||||
|
Graph graph,
|
||||||
|
Coordinate2D centerCoordinate,
|
||||||
|
int detectorRadius,
|
||||||
|
int vehicleTurnRadius)
|
||||||
|
{
|
||||||
|
var detectorCells = graph.GetRange(centerCoordinate, detectorRadius);
|
||||||
|
// var vehicleCells = graph.GetRange(centerCoordinate, vehicleTurnRadius);
|
||||||
|
// foreach (var vehicleCell in vehicleCells)
|
||||||
|
// {
|
||||||
|
// detectorCells.Remove(vehicleCell);
|
||||||
|
// }
|
||||||
|
return detectorCells;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Cell> GetCoveredCells(
|
||||||
|
ISquareMap squareMap,
|
||||||
|
Cell centerCell,
|
||||||
|
int detectorRadius) => squareMap.GetRange(centerCell, detectorRadius);
|
||||||
|
}
|
||||||
|
}
|
||||||
15
ConsoleApp/Sim/IVehicle.cs
Normal file
15
ConsoleApp/Sim/IVehicle.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using ConsoleApp.Maps;
|
||||||
|
using HexCore;
|
||||||
|
|
||||||
|
namespace ConsoleApp.Sim
|
||||||
|
{
|
||||||
|
public interface IVehicle
|
||||||
|
{
|
||||||
|
int Length { get; }
|
||||||
|
int Width { get; }
|
||||||
|
int TurnRadius { get; }
|
||||||
|
int DetectorRadius { get;}
|
||||||
|
Coordinate2D CurrentHexCell { get; set; }
|
||||||
|
ICell CurrentSquareCell { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
35
ConsoleApp/Sim/Vehicle.cs
Normal file
35
ConsoleApp/Sim/Vehicle.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using ConsoleApp.Maps;
|
||||||
|
|
||||||
|
namespace ConsoleApp.Sim
|
||||||
|
{
|
||||||
|
public class Vehicle : IVehicle
|
||||||
|
{
|
||||||
|
public int Length { get; }
|
||||||
|
public int Width { get; }
|
||||||
|
public int TurnRadius { get; }
|
||||||
|
public int DetectorRadius { get;}
|
||||||
|
public HexCore.Coordinate2D CurrentHexCell { get; set; }
|
||||||
|
public ICell CurrentSquareCell { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public Vehicle(IJsonDeserializor jsonDeserializor)
|
||||||
|
{
|
||||||
|
var config = jsonDeserializor.DeserializeObject<VehicleConfiguration>("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Sim/VehicleConfiguration.json");
|
||||||
|
var length = config.Length;
|
||||||
|
length *= 100;
|
||||||
|
Length = (int)Math.Ceiling((decimal)length/ 25);
|
||||||
|
var width = config.Width;
|
||||||
|
width *= 100;
|
||||||
|
Width = (int)Math.Ceiling((decimal)width/ 25);
|
||||||
|
DetectorRadius = (int)Math.Floor(((decimal)config.DetectorRadius * 100)/25)/2;
|
||||||
|
TurnRadius = (int)Math.Ceiling(Math.Sqrt(Math.Pow(config.Length, 2) * Math.Pow(config.Width, 2))/2);
|
||||||
|
// if (DetectorRadius <= TurnRadius)
|
||||||
|
// throw new ArgumentException("Detection radius must be larger than the vehicle turn radius");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
ConsoleApp/Sim/VehicleConfiguration.cs
Normal file
9
ConsoleApp/Sim/VehicleConfiguration.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace ConsoleApp.Sim
|
||||||
|
{
|
||||||
|
public class VehicleConfiguration
|
||||||
|
{
|
||||||
|
public int Length { get; set; }
|
||||||
|
public int Width { get; set; }
|
||||||
|
public int DetectorRadius { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
5
ConsoleApp/Sim/VehicleConfiguration.json
Normal file
5
ConsoleApp/Sim/VehicleConfiguration.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"Length": 1,
|
||||||
|
"Width": 1,
|
||||||
|
"DetectorRadius": 1
|
||||||
|
}
|
||||||
@@ -1,19 +1,150 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using ConsoleApp.Maps;
|
using ConsoleApp.Maps;
|
||||||
|
using ConsoleApp.PathPlanners;
|
||||||
|
using ConsoleApp.Sim;
|
||||||
|
using HexCore;
|
||||||
|
using ImTools;
|
||||||
|
using Microsoft.VisualBasic;
|
||||||
|
|
||||||
namespace ConsoleApp
|
namespace ConsoleApp
|
||||||
{
|
{
|
||||||
public class SimRunner : ISimRunner
|
public class SimRunner : ISimRunner
|
||||||
{
|
{
|
||||||
private IMapFactory _mapFactory;
|
private IMapFactory _mapFactory;
|
||||||
|
private IVehicle _vehicle;
|
||||||
|
|
||||||
public SimRunner(IMapFactory mapFactory)
|
private IPathPlanner _pathPlanner;
|
||||||
|
private IMineMap _mineMap;
|
||||||
|
private IReactivePathPlanner _reactivePathPlanner;
|
||||||
|
private HashSet<Coordinate2D> hexBombsFound = new HashSet<Coordinate2D>();
|
||||||
|
private List<Coordinate2D> testingPath = new List<Coordinate2D>();
|
||||||
|
private ISimulationResults _simulationResults;
|
||||||
|
|
||||||
|
|
||||||
|
public SimRunner(IMapFactory mapFactory, IVehicle vehicle, IPathPlanner pathPlanner, IReactivePathPlanner reactivePathPlanner, ISimulationResults simulationResults)
|
||||||
{
|
{
|
||||||
_mapFactory = mapFactory;
|
_mapFactory = mapFactory;
|
||||||
|
_vehicle = vehicle;
|
||||||
|
_pathPlanner = pathPlanner;
|
||||||
|
_reactivePathPlanner = reactivePathPlanner;
|
||||||
|
_simulationResults = simulationResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Run()
|
public void Run()
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
_mineMap = _mapFactory.GetMineMap();
|
||||||
|
_simulationResults.Mines = _mineMap.PlacedMines;
|
||||||
|
_simulationResults.TotalBombs = _mineMap.TotalBombs;
|
||||||
|
SquareSimulation();
|
||||||
|
HexSimulation();
|
||||||
|
// while(!squareTask.IsCompleted && !hexTask.IsCompleted){Thread.Sleep(500);}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void HexSimulation()
|
||||||
|
{
|
||||||
|
var hexMap = _mapFactory.GetHexMap();
|
||||||
|
_vehicle.CurrentHexCell = new Coordinate2D(0, 0, OffsetTypes.OddRowsRight);
|
||||||
|
var optimalPath = _pathPlanner.GenerateOptimalHexPath(hexMap, _vehicle);
|
||||||
|
var finished = false;
|
||||||
|
var totalMoves = 0;
|
||||||
|
while (!finished)
|
||||||
|
{
|
||||||
|
totalMoves += 1;
|
||||||
|
_simulationResults.HexPath.Add(_vehicle.CurrentHexCell);
|
||||||
|
|
||||||
|
var detectionCells = DetectionHead.GetCoveredCells(hexMap.Graph, _vehicle.CurrentHexCell, _vehicle.DetectorRadius, _vehicle.TurnRadius);
|
||||||
|
//Check Cells for mine
|
||||||
|
var detection = CheckCells(detectionCells);
|
||||||
|
//mark as cleared
|
||||||
|
hexMap.Graph.SetCellsTerrainType(detectionCells, hexMap.ClearedTerrain);
|
||||||
|
//Handle any detections
|
||||||
|
if (detection)
|
||||||
|
{
|
||||||
|
_reactivePathPlanner.GenerateReactiveHexPath(hexMap, optimalPath, _vehicle.CurrentHexCell);
|
||||||
|
}
|
||||||
|
|
||||||
|
//If the reactive Planner is not empty, empty it before the optimal.
|
||||||
|
if (_reactivePathPlanner.ReactiveHexPath.TryDequeue(out var next))
|
||||||
|
_vehicle.CurrentHexCell = next;
|
||||||
|
//Else we will work off of the optimal path
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//If the optimal path is empty we are done otherwise pop.
|
||||||
|
if (!optimalPath.TryDequeue(out var nextOptimal))
|
||||||
|
{
|
||||||
|
finished = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hexMap.Graph.IsCellBlocked(nextOptimal))
|
||||||
|
{
|
||||||
|
_reactivePathPlanner.GenerateReactiveHexPath(hexMap, optimalPath, _vehicle.CurrentHexCell);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_vehicle.CurrentHexCell = nextOptimal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Debugging information
|
||||||
|
var (cleared, uncleared) = CoveredCells();
|
||||||
|
_simulationResults.HexClearedCells = cleared;
|
||||||
|
_simulationResults.HexUnClearedCells = uncleared;
|
||||||
|
_simulationResults.HexTotalMoves = totalMoves;
|
||||||
|
_simulationResults.HexBombsFound = hexBombsFound.Count;
|
||||||
|
}
|
||||||
|
|
||||||
|
private (int, int) CoveredCells()
|
||||||
|
{
|
||||||
|
var cleared = 0;
|
||||||
|
var uncleared = 0;
|
||||||
|
var hexMap = _mapFactory.GetHexMap();
|
||||||
|
foreach (var cellState in hexMap.Graph.GetAllCells())
|
||||||
|
{
|
||||||
|
if (cellState.TerrainType.Id == hexMap.ClearedTerrain.Id)
|
||||||
|
cleared++;
|
||||||
|
if (cellState.TerrainType.Id == hexMap.UnclearedTerrain.Id)
|
||||||
|
uncleared++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (cleared, uncleared);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private bool CheckCells(List<Coordinate2D> detectionCells)
|
||||||
|
{
|
||||||
|
var found = false;
|
||||||
|
foreach (var cell in detectionCells.Where(cell => _mineMap.GetCell(cell.X, cell.Y)))
|
||||||
|
{
|
||||||
|
if (!hexBombsFound.Add(cell)) continue;
|
||||||
|
BlockCells(cell);
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BlockCells(Coordinate2D cell)
|
||||||
|
{
|
||||||
|
var hexMap = _mapFactory.GetHexMap();
|
||||||
|
var cellsToBlock = hexMap.Graph.GetRange(cell, _vehicle.Width / 2);
|
||||||
|
hexMap.Graph.BlockCells(cellsToBlock);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void SquareSimulation()
|
||||||
|
{
|
||||||
|
var squareMap = _mapFactory.GetSquareMap();
|
||||||
|
_vehicle.CurrentSquareCell = squareMap.StartingCell;
|
||||||
|
var optimalPath = _pathPlanner.GenerateOptimalSquarePath(squareMap, _vehicle);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
104
ConsoleApp/SimulationResults.cs
Normal file
104
ConsoleApp/SimulationResults.cs
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Threading;
|
||||||
|
using ConsoleApp.Maps;
|
||||||
|
using HexCore;
|
||||||
|
|
||||||
|
namespace ConsoleApp
|
||||||
|
{
|
||||||
|
public class SimulationResults : ISimulationResults
|
||||||
|
{
|
||||||
|
public int HexTotalMoves { get; set; }
|
||||||
|
public int HexBombsFound { get; set; }
|
||||||
|
public int TotalBombs { get; set; }
|
||||||
|
public List<Coordinate2D> HexPath { get; set; }
|
||||||
|
public List<Coordinate2D> HexMappedBombs { get; set; }
|
||||||
|
public List<Cell> Mines { get; set; }
|
||||||
|
public int HexClearedCells { get; set; }
|
||||||
|
public int HexUnClearedCells { get; set; }
|
||||||
|
|
||||||
|
public SimulationResults()
|
||||||
|
{
|
||||||
|
HexTotalMoves = 0;
|
||||||
|
HexBombsFound = 0;
|
||||||
|
TotalBombs = 0;
|
||||||
|
HexPath = new List<Coordinate2D>();
|
||||||
|
HexMappedBombs = new List<Coordinate2D>();
|
||||||
|
Mines = new List<Cell>();
|
||||||
|
HexClearedCells = 0;
|
||||||
|
HexUnClearedCells = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WriteResults()
|
||||||
|
{
|
||||||
|
WriteData();
|
||||||
|
WriteMines();
|
||||||
|
WritePaths();
|
||||||
|
WriteDetectedMines();
|
||||||
|
GenerateImages();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void GenerateImages()
|
||||||
|
{
|
||||||
|
var file = Path.Combine("./",Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"HexPlot.py");
|
||||||
|
ProcessStartInfo startInfo = new ProcessStartInfo()
|
||||||
|
{
|
||||||
|
FileName = "python3",
|
||||||
|
Arguments = file,
|
||||||
|
UseShellExecute = true
|
||||||
|
};
|
||||||
|
Process proc = new Process()
|
||||||
|
{
|
||||||
|
StartInfo = startInfo,
|
||||||
|
};
|
||||||
|
proc.Start();
|
||||||
|
while (!proc.HasExited)
|
||||||
|
{
|
||||||
|
Thread.Sleep(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteData()
|
||||||
|
{
|
||||||
|
using(TextWriter tw = new StreamWriter("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/Data.txt"))
|
||||||
|
{
|
||||||
|
tw.WriteLine($"General:");
|
||||||
|
tw.WriteLine($"\t Total Mines: {TotalBombs}");
|
||||||
|
tw.WriteLine($"Hex: ");
|
||||||
|
tw.WriteLine($"\t Total Moves: {HexTotalMoves}");
|
||||||
|
tw.WriteLine($"\t Bombs Found: {HexBombsFound}");
|
||||||
|
tw.WriteLine($"\t Cleared Cell Count: {HexClearedCells}");
|
||||||
|
tw.WriteLine($"\t Uncleared Cell Count: {HexUnClearedCells}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteMines()
|
||||||
|
{
|
||||||
|
using(TextWriter tw = new StreamWriter("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/Mines.txt"))
|
||||||
|
{
|
||||||
|
foreach (var s in Mines)
|
||||||
|
tw.WriteLine($"{s.X} {s.Y}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteDetectedMines()
|
||||||
|
{
|
||||||
|
using(TextWriter tw = new StreamWriter("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/HexDetectedMines.txt"))
|
||||||
|
{
|
||||||
|
foreach (Coordinate2D s in HexMappedBombs)
|
||||||
|
tw.WriteLine($"{s.X} {s.Y}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WritePaths()
|
||||||
|
{
|
||||||
|
using(TextWriter tw = new StreamWriter("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/HexPath.txt"))
|
||||||
|
{
|
||||||
|
foreach (Coordinate2D s in HexPath)
|
||||||
|
tw.WriteLine($"{s.X} {s.Y}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using ConsoleApp.Maps;
|
using ConsoleApp.Maps;
|
||||||
|
|
||||||
@@ -6,8 +7,6 @@ namespace ConsoleApp
|
|||||||
{
|
{
|
||||||
public class UserConsole : IUserConsole
|
public class UserConsole : IUserConsole
|
||||||
{
|
{
|
||||||
private IMapFactory _mapFactory;
|
|
||||||
|
|
||||||
public UserConsole()
|
public UserConsole()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -19,28 +18,40 @@ namespace ConsoleApp
|
|||||||
$"\t 2: Load custom map. \n");
|
$"\t 2: Load custom map. \n");
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetUserInput() => Console.ReadLine();
|
public static string GetUserInput() => Console.ReadLine();
|
||||||
|
|
||||||
public void PrintInvalidInput()
|
public static void PrintInvalidInput() => Console.WriteLine($"Invalid input try again \n");
|
||||||
{
|
|
||||||
Console.WriteLine($"Invalid input try again \n");
|
|
||||||
}
|
|
||||||
|
|
||||||
public (int width, int height) GetMapDimensions()
|
public (int width, int height) GetMapDimensions()
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Enter Dimensions of map/area to clear as (x, y)");
|
Console.WriteLine($"Enter map width: ");
|
||||||
var input = GetUserInput();
|
var x = GetUserInput();
|
||||||
var numbers = input.Split();
|
|
||||||
if (numbers.Length != 4)
|
if (!int.TryParse(x, out var width))
|
||||||
{
|
{
|
||||||
PrintInvalidInput();
|
PrintInvalidInput();
|
||||||
GetMapDimensions();
|
GetMapDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
var parsedNumbers = numbers.Where(x => !(x.Equals("(") || x.Equals(")"))).ToList();
|
Console.WriteLine($"Enter map height: ");
|
||||||
int.TryParse(parsedNumbers[0], out var width);
|
var y = GetUserInput();
|
||||||
int.TryParse(parsedNumbers[1], out var height);
|
if (int.TryParse(y, out var height)) return (width, height);
|
||||||
|
PrintInvalidInput();
|
||||||
|
GetMapDimensions();
|
||||||
return (width, height);
|
return (width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static double GetMinePercentage()
|
||||||
|
{
|
||||||
|
|
||||||
|
Console.WriteLine($"Enter desired percentage of mines: ");
|
||||||
|
var x = GetUserInput();
|
||||||
|
|
||||||
|
if (double.TryParse(x, out var percent)) return percent;
|
||||||
|
PrintInvalidInput();
|
||||||
|
GetMinePercentage();
|
||||||
|
|
||||||
|
return percent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
4
RobotIntelFinal.sln.DotSettings.user
Normal file
4
RobotIntelFinal.sln.DotSettings.user
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/DotNetCliExePath/@EntryValue">/Users/brady.bodily/.dotnet/dotnet</s:String>
|
||||||
|
|
||||||
|
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/CustomBuildToolPath/@EntryValue">/Users/brady.bodily/.dotnet/sdk/3.1.402/MSBuild.dll</s:String></wpf:ResourceDictionary>
|
||||||
Reference in New Issue
Block a user