Merge branch 'SquareSimulation' into main

This commit is contained in:
2020-12-16 18:04:49 -07:00
39 changed files with 9122 additions and 1005 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -7,7 +7,6 @@
<e p="Bootstrapper.cs" t="Include" />
<e p="ConsoleApp.csproj" t="IncludeRecursive" />
<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="ISimRunner.cs" t="Include" />
@@ -15,6 +14,7 @@
<e p="IUserConsole.cs" t="Include" />
<e p="JsonDeserializor.cs" t="Include" />
<e p="Maps" t="Include">
<e p="AstarSquareSearch.cs" t="Include" />
<e p="Cell.cs" t="Include" />
<e p="GlobalDirection.cs" t="Include" />
<e p="Heading.cs" t="Include" />
@@ -38,16 +38,27 @@
</e>
<e p="Output" t="Include">
<e p="Data.txt" t="Include" />
<e p="HexCoverage.png" t="Include" />
<e p="HexCoveredCells.txt" t="Include" />
<e p="HexDetectedMines.txt" t="Include" />
<e p="HexPath.txt" t="Include" />
<e p="HexTest.png" t="Include" />
<e p="Mines.txt" t="Include" />
<e p="SquareCoverage.png" t="Include" />
<e p="SquareCoveredCells.txt" t="Include" />
<e p="SquareDetectedMines.txt" t="Include" />
<e p="SquarePath.txt" t="Include" />
<e p="SquareTest.png" t="Include" />
</e>
<e p="Output 2.zip" t="Include" />
<e p="Output.zip" t="Include" />
<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="plotGraphs.py" t="Include" />
<e p="Program.cs" t="Include" />
<e p="Sim" t="Include">
<e p="DetectionHead.cs" t="Include" />

View File

@@ -18,21 +18,24 @@
</component>
<component name="ChangeListManager">
<list default="true" id="dafcaeb7-80aa-43a3-a480-786fafb78c0b" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/ConsoleApp/ISimulationResults.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ConsoleApp/SimulationResults.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/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/ConsoleApp.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/ConsoleApp.csproj" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/CoreModule.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/CoreModule.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/IMineMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/IMineMap.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/HexPlot.py" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/plotGraphs.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Output/Data.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Output/Data.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Output/HexCoverage.png" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Output/HexCoverage.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Output/HexCoveredCells.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Output/HexCoveredCells.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Output/HexDetectedMines.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Output/HexDetectedMines.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Output/HexPath.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Output/HexPath.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Output/HexTest.png" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Output/HexTest.png" 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/Output/SquareCoverage.png" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Output/SquareCoverage.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Output/SquareCoveredCells.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Output/SquareCoveredCells.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Output/SquareDetectedMines.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Output/SquareDetectedMines.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Output/SquarePath.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Output/SquarePath.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Output/SquareTest.png" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Output/SquareTest.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.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/plot.py" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/HexPlot.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/UserConsole.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/UserConsole.cs" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -50,38 +53,10 @@
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</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/0b/0953c23b/GraphFactory.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" />
@@ -90,16 +65,29 @@
<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/39B/EqualityComparer.CoreCLR.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/EE5CA5D4-EDEB-48AE-9C0D-FE354330FB77/da/c3cabb46/AStarSearch.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="mock:///Dummy.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="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="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/EB067793-5C3F-4219-AEF1-3AB117C20649/CD/ThrowHelper.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/389/Comparer.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/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/DecompilerCache/decompiler/EE5CA5D4-EDEB-48AE-9C0D-FE354330FB77/3d/c367b191/Coordinate3D.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" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/EE5CA5D4-EDEB-48AE-9C0D-FE354330FB77/14/12025305/MovementTypes.cs" root0="SKIP_HIGHLIGHTING" />
</component>
<component name="IdeDocumentHistory">
<changedPaths>
@@ -112,39 +100,41 @@
<option value="$PROJECT_DIR$/ConsoleApp/IVehicle.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IMap.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Vehicle.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/ISquareMap.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Vehicle/DetectionHead.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Vehicle/Vehicle.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Vehicle/VehicleConfiguration.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Vehicle/IVehicle.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/Cell.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/Maps/SquareMap.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/MapFactory.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IMapFactory.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Sim/VehicleConfiguration.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Sim/Vehicle.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Sim/VehicleConfiguration.json" />
<option value="$PROJECT_DIR$/ConsoleApp/Sim/DetectionHead.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs" />
<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/Maps/ICell.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/MapExtensions.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/IReactivePathPlanner.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/ReactivePathPlanner.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/AstarSquareSearch.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/Cell.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/ISquareMap.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/ISimulationResults.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Program.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/SimulationResults.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Sim/DetectionHead.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Sim/VehicleConfiguration.json" />
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/UserConsole.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/HexPlot.py" />
<option value="$PROJECT_DIR$/ConsoleApp/Program.cs" />
</changedPaths>
</component>
<component name="ProjectId" id="1lIZ7IfsUjzqV2Jb1obOFvGFAfp" />
@@ -156,7 +146,7 @@
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="DebuggerViewTab_PTCS_FirstProportionKey" value="0.3496007" />
<property name="DebuggerViewTab_PTCS_FirstProportionKey" value="0.22508793" />
<property name="DebuggerViewTab_PTCS_LastProportionKey" value="0.0" />
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
@@ -222,7 +212,9 @@
<workItem from="1607982179018" duration="634000" />
<workItem from="1607983288378" duration="86000" />
<workItem from="1607983862958" duration="7777000" />
<workItem from="1607993290571" duration="72449000" />
<workItem from="1607993290571" duration="88336000" />
<workItem from="1608146906461" duration="175000" />
<workItem from="1608147111263" duration="16256000" />
</task>
<servers />
</component>
@@ -247,33 +239,10 @@
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="DotNet Breakpoints">
<url>file://$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs</url>
<line>34</line>
<properties documentPath="$PROJECT_DIR$/ConsoleApp/PathPlanner.cs" initialLine="34" containingFunctionPresentation="method 'GenerateOptimalSquarePath'">
<startOffsets>
<option value="1527" />
</startOffsets>
<endOffsets>
<option value="1543" />
</endOffsets>
</properties>
<option name="timeStamp" value="24" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
<pin-to-top-manager>
<pinned-members>
<PinnedItemInfo parentTag="Frame#ConsoleApp.PathPlanners.PathPlanner.GenerateOptimalHexPath" memberName="path" />
</pinned-members>
</pin-to-top-manager>
<watches-manager>
<configuration name="DotNetProject">
<watch expression="new System.Collections.Generic.QueueDebugView&lt;HexCore.Coordinate2D&gt;(optimalPath).Items[0]" />
<watch expression="Math.Abs(nextOptimal.X - _vehicle.CurrentHexCell.X) &gt; 1 || Math.Abs(nextOptimal.Y - _vehicle.CurrentHexCell.Y) &gt; 1" language="C#" />
</configuration>
</watches-manager>
</component>
</project>

BIN
ConsoleApp/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -22,7 +22,7 @@
<None Update="Sim\VehicleConfiguration.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="HexPlot.py">
<None Update="plotGraphs.py">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

View File

@@ -1,39 +0,0 @@
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)

View File

@@ -15,5 +15,13 @@ namespace ConsoleApp
List<Cell> Mines { get; set; }
int HexClearedCells { get; set; }
int HexUnClearedCells { get; set; }
List<ICell> SquarePath { get; set; }
List<ICell> SquareMappedBombs { get; set; }
int SquareCellsUncleared { get; set; }
int SquareCellsCleared { get; set; }
int SquareBombsFound { get; set; }
int SquareTotalMoves { get; set; }
List<ICell> SquareCoveredCells { get; set; }
List<Coordinate2D> HexCoveredCells { get; set; }
}
}

View File

@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using HexCore;
namespace ConsoleApp.Maps
{
public class AstarSquareSearch
{
private static double Heuristic(ICell a, ICell b)
{
return Math.Abs(a.X - b.X) + Math.Abs(a.Y - b.Y);
}
public static List<ICell> FindShortestPath(ISquareMap graph, ICell start, ICell goal)
{
var costSoFar = new Dictionary<ICell, int>();
var cameFrom = new Dictionary<ICell, ICell>();
var frontier = new PriorityQueue<ICell>();
frontier.Enqueue(start, 0);
cameFrom[start] = start;
costSoFar[start] = 0;
while (frontier.Count > 0)
{
var current = frontier.Dequeue();
if (current.Equals(goal)) break;
foreach (var next in graph.GetPassableNeighbors(current))
{
var newCost = costSoFar[current] + (int)graph.GetCell(next.X, next.Y).Coverage;
if (costSoFar.ContainsKey(next) && newCost >= costSoFar[next]) continue;
costSoFar[next] = newCost;
var priority = newCost + Heuristic(next, goal);
frontier.Enqueue(next, priority);
cameFrom[next] = current;
}
}
var path = new List<ICell>();
var pathWasNotFound = !cameFrom.ContainsKey(goal);
// Returning an empty list if the path wasn't found
if (pathWasNotFound) return path;
// Reconstructing path
var curr = goal;
while (!curr.Equals(start))
{
path.Add(curr);
curr = cameFrom[curr];
}
// Reverse it to start at actual start point
path.Reverse();
return path;
}
}
}

View File

@@ -4,20 +4,23 @@ namespace ConsoleApp.Maps
{
public enum Coverage
{
Uncoverd,
//Order here matters these are cast to ints for the heuristic algorithm
Uncovered,
Covered
}
public struct Cell : ICell
public class Cell : ICell
{
public int X { get; }
public int Y { get; }
public Coverage Coverage { get; set; }
public bool Blocked { get; set; }
public Cell(int x, int y)
{
X = x;
Y = y;
Coverage = Coverage.Uncoverd;
Coverage = Coverage.Uncovered;
Blocked = false;
}

View File

@@ -5,5 +5,6 @@ namespace ConsoleApp.Maps
int X { get; }
int Y { get; }
Coverage Coverage { get; set; }
bool Blocked { get; set; }
}
}

View File

@@ -12,6 +12,9 @@ namespace ConsoleApp.Maps
Cell GetCell(int x, int y);
int Height { get; }
int Width { get; }
List<Cell> GetRange(Cell centerCell, int radius);
List<Cell> GetRange(ICell centerCell, int radius);
List<Cell> GetNeighbors(ICell cell);
List<ICell> GetPassableNeighbors(ICell cell);
List<ICell> GetShortestPath(ICell start, ICell goal);
}
}

View File

@@ -1,5 +1,12 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using Example;
namespace ConsoleApp.Maps
{
public static class MapExtensions
{
public static void Fill2DArray<T>(this T[,] arr, T value)

View File

@@ -1,5 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Metadata.Ecma335;
using System.Threading;
using HexCore;
namespace ConsoleApp.Maps
@@ -29,8 +33,7 @@ namespace ConsoleApp.Maps
//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++)
@@ -38,6 +41,9 @@ namespace ConsoleApp.Maps
Map[i,j] = new Cell(i, j);
}
}
//set Starting cell;
StartingCell = GetCell(0,0);
}
@@ -56,8 +62,13 @@ namespace ConsoleApp.Maps
return possibles;
}
public List<ICell> GetShortestPath(ICell start, ICell goal)
{
return AstarSquareSearch.FindShortestPath(this, start, goal);
}
public List<Cell> GetRange(Cell centerCell, int radius)
public List<Cell> GetRange(ICell centerCell, int radius)
{
var inRange = new List<Cell>();
var cx = centerCell.X;
@@ -77,6 +88,32 @@ namespace ConsoleApp.Maps
return inRange;
}
public List<ICell> GetPassableNeighbors(ICell cell) =>
GetNeighbors(cell).Where(neighbor => !neighbor.Blocked).Cast<ICell>().ToList();
private static int ComputeHScore(ICell src, Cell dest)
{
return Math.Abs(dest.X - src.X) + Math.Abs(dest.Y - src.Y);
}
public List<Cell> GetNeighbors(ICell cell)
{
var rlist = new List<Cell>();
var rowOperations = new int[] { -1, 0, 0, 1};
var colOperations = new int[] {0, -1, 1, 0};
for (var i = 0; i < 4; i++)
{
var curCell = GetCell(cell.X + rowOperations[i], cell.Y + colOperations[i]);
if (curCell != default)
{
rlist.Add(curCell);
}
}
return rlist;
}
private Cell GetTopCellInBoundingBox(int cx, int cy, int radius)
{
int topX, topY;
@@ -91,16 +128,21 @@ namespace ConsoleApp.Maps
private Cell GetBottomCellInBoundingBox(int cx, int cy, int radius)
{
int bottomX, bottomY;
if (cy - radius > 0) bottomY = 0;
if (cy - radius < 0) bottomY = 0;
else
bottomY = cy - radius;
if (cx + radius < Width) bottomX = Width;
if (cx + radius > Width) bottomX = Width;
else
bottomX = cx + radius;
return Map[bottomX, bottomY];
}
public Cell GetCell(int x, int y) => Map[x, y];
public Cell GetCell(int x, int y)
{
if (x > Width || y > Height || x < 0 || y < 0)
return default;
return Map[x, y];
}
}
}

BIN
ConsoleApp/Output 2.zip Normal file

Binary file not shown.

BIN
ConsoleApp/Output.zip Normal file

Binary file not shown.

View File

@@ -1,7 +1,14 @@
General:
Total Mines: 23
Total Mines: 36
Hex:
Total Moves: 927
Bombs Found: 23
Cleared Cell Count: 2295
Total Moves: 687
Bombs Found: 35
Cleared Cell Count: 3591
Uncleared Cell Count: 9
Percentage Cleared: 99.75
Square:
Total Moves: 1045
Bombs Found: 34
Cleared Cell Count: 3251
Uncleared Cell Count: 349
Percentage Cleared: 90.30555555555554

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,35 @@
48 7
47 13
35 8
12 8
5 18
31 14
28 20
36 14
37 12
42 18
49 16
45 23
42 23
49 27
42 29
6 22
10 28
9 31
19 27
54 29
16 39
10 34
26 40
33 42
50 42
52 53
45 48
38 48
36 51
34 51
29 54
30 50
27 54
26 49
12 49

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -0,0 +1,36 @@
30 50
48 7
16 39
42 18
47 13
50 42
52 53
49 16
36 14
54 29
6 22
26 49
28 20
10 34
27 54
49 27
35 8
26 40
38 48
10 28
12 8
5 18
42 23
45 23
42 29
36 51
37 12
29 54
34 51
33 12
45 48
19 27
12 49
31 14
33 42
9 31

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,34 @@
48 7
47 13
49 16
35 8
12 8
31 14
28 20
36 14
42 18
42 23
42 29
49 27
54 29
45 23
6 22
5 18
9 31
10 28
10 34
16 39
19 27
26 40
33 42
38 48
34 51
36 51
30 50
26 49
27 54
29 54
45 48
52 53
50 42
12 49

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -8,5 +8,10 @@ namespace ConsoleApp.PathPlanners
{
Queue<Coordinate2D> ReactiveHexPath { get; }
void GenerateReactiveHexPath(IHexMap hexMap, Queue<Coordinate2D> optimalPath, Coordinate2D vehicleCurrentHexCell);
Queue<ICell> ReactiveSquarePath { get; }
void GenerateReactiveSquarePath(ISquareMap squareMap, Queue<ICell> optimalPath,
ICell vehicleCurrentSquareCell);
}
}

View File

@@ -11,49 +11,49 @@ namespace ConsoleApp.PathPlanners
{
public Queue<ICell> GenerateOptimalSquarePath(ISquareMap map, IVehicle vehicle)
{
var path = new Queue<ICell>();
var myCell = map.StartingCell;
var currentPostion = vehicle.CurrentSquareCell;
var currentHeading = GlobalDirection.East;
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;
var path = new List<ICell>();
while (!finished)
{
var availableMoves = map.PossibleMoves(myCell);
if (availableMoves.Contains(GlobalDirection.North) && currentHeading == GlobalDirection.North &&
myCell.Y != map.Height)
//Heading East
if (currentHeading == GlobalDirection.East)
{
path.Enqueue(map.GetCell(myCell.X, myCell.Y + 1));
myCell = map.GetCell(myCell.X, myCell.Y + 1);
path.AddRange(
map.GetShortestPath(currentPostion, map.GetCell(map.Width - 1, currentPostion.Y)));
currentPostion = new Cell(map.Width - 1, currentPostion.Y);
}
else if (availableMoves.Contains(GlobalDirection.South) && currentHeading == GlobalDirection.South && myCell.Y != 0)
//Heading West
else if (currentHeading == GlobalDirection.West)
{
path.Enqueue(map.GetCell(myCell.X, myCell.Y - 1));
myCell = map.GetCell(myCell.X, myCell.Y - 1);
path.AddRange(
map.GetShortestPath(currentPostion, map.GetCell(0, currentPostion.Y)));
currentPostion = new Cell(0, currentPostion.Y);
}
else
//Check for finish
if (currentPostion.Y + (vehicle.DetectorRadius * 2) >= map.Height)
{
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;
}
finished = true;
continue;
}
//Move up X Axis
path.AddRange(
map.GetShortestPath(
currentPostion,
map.GetCell(currentPostion.X, currentPostion.Y + (vehicle.DetectorRadius * 2) - 1)));
currentPostion = new Cell(currentPostion.X, currentPostion.Y + (vehicle.DetectorRadius * 2) -1);
if (currentHeading == GlobalDirection.East)
currentHeading = GlobalDirection.West;
else
currentHeading = GlobalDirection.East;
}
return path;
return new Queue<ICell>(path);
}
public Queue<Coordinate2D> GenerateOptimalHexPath(IHexMap hexMap, IVehicle vehicle)

View File

@@ -7,12 +7,17 @@ namespace ConsoleApp.PathPlanners
public class ReactivePathPlanner : IReactivePathPlanner
{
private Queue<Coordinate2D> _reactiveHexPath;
private Queue<ICell> _reactiveSquarePath;
public Queue<Coordinate2D> ReactiveHexPath => _reactiveHexPath;
public Queue<ICell> ReactiveSquarePath => _reactiveSquarePath;
public ReactivePathPlanner()
{
_reactiveHexPath = new Queue<Coordinate2D>();
_reactiveSquarePath = new Queue<ICell>();
}
public void GenerateReactiveHexPath(IHexMap hexMap, Queue<Coordinate2D> optimalPath,
Coordinate2D vehicleCurrentHexCell)
@@ -39,6 +44,33 @@ namespace ConsoleApp.PathPlanners
_reactiveHexPath.Enqueue(node);
}
}
public void GenerateReactiveSquarePath(ISquareMap squareMap, Queue<ICell> optimalPath,
ICell vehicleCurrentSquareCell)
{
//Clean out old path
_reactiveSquarePath.Clear();
//If the optimal path is empty well we are done, otherwise pop 1
if (!optimalPath.TryDequeue(out ICell convergentPoint))
return;
//Dequeue until the cell is not blocked
while (squareMap.GetCell(convergentPoint.X, convergentPoint.Y).Blocked)
{
//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 map = (SquareMap)squareMap;
var reactivePath = map.GetShortestPath(vehicleCurrentSquareCell, convergentPoint);
foreach (var node in reactivePath)
{
_reactiveSquarePath.Enqueue(node);
}
}
}
}

View File

@@ -19,6 +19,7 @@ namespace ConsoleApp
_userConsole = new UserConsole();
Initialization();
simResults.WriteResults();
GenerateImages();
Console.WriteLine("Program Completed");
}
@@ -26,19 +27,10 @@ namespace ConsoleApp
private static void Initialization()
{
_userConsole.PrintStartMenu();
var input = UserConsole.GetUserInput();
if (input == "1")
{
var (x,y) = _userConsole.GetMapDimensions();
var minePercentage = UserConsole.GetMinePercentage();
RunSimulation(x, y, minePercentage);
}
else
{
UserConsole.PrintInvalidInput();
Initialization();
}
var (x,y) = _userConsole.GetMapDimensions();
var minePercentage = 1;
RunSimulation(x, y, minePercentage);
}
private static void RunSimulation(int x, int y, double minePercentage)
@@ -49,6 +41,26 @@ namespace ConsoleApp
mapFactory.GenerateMaps(x, y, minePercentage);
simRunner.Run();
}
private static void GenerateImages()
{
var file = Path.Combine("./",Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"plotGraphs.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);
}
}
}
}

View File

@@ -24,6 +24,6 @@ namespace ConsoleApp.Sim
public static List<Cell> GetCoveredCells(
ISquareMap squareMap,
Cell centerCell,
int detectorRadius) => squareMap.GetRange(centerCell, detectorRadius);
int detectorRadius) => squareMap.GetRange(centerCell, detectorRadius * 2 - detectorRadius%2);
}
}

View File

@@ -10,6 +10,6 @@ namespace ConsoleApp.Sim
int TurnRadius { get; }
int DetectorRadius { get;}
Coordinate2D CurrentHexCell { get; set; }
ICell CurrentSquareCell { get; set; }
Cell CurrentSquareCell { get; set; }
}
}

View File

@@ -11,7 +11,7 @@ namespace ConsoleApp.Sim
public int TurnRadius { get; }
public int DetectorRadius { get;}
public HexCore.Coordinate2D CurrentHexCell { get; set; }
public ICell CurrentSquareCell { get; set; }
public Cell CurrentSquareCell { get; set; }

View File

@@ -1,5 +1,5 @@
{
"Length": 1,
"Width": 1,
"DetectorRadius": 1
"DetectorRadius": 2
}

View File

@@ -1,16 +1,10 @@
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.PathPlanners;
using ConsoleApp.Sim;
using HexCore;
using ImTools;
using Microsoft.VisualBasic;
namespace ConsoleApp
{
@@ -23,8 +17,9 @@ namespace ConsoleApp
private IMineMap _mineMap;
private IReactivePathPlanner _reactivePathPlanner;
private HashSet<Coordinate2D> hexBombsFound = new HashSet<Coordinate2D>();
private List<Coordinate2D> testingPath = new List<Coordinate2D>();
private ISimulationResults _simulationResults;
private HashSet<ICell> squareBombsFound = new HashSet<ICell>();
public SimRunner(IMapFactory mapFactory, IVehicle vehicle, IPathPlanner pathPlanner, IReactivePathPlanner reactivePathPlanner, ISimulationResults simulationResults)
@@ -47,6 +42,8 @@ namespace ConsoleApp
}
#region HexSimulation
private void HexSimulation()
{
var hexMap = _mapFactory.GetHexMap();
@@ -80,7 +77,7 @@ namespace ConsoleApp
if (!optimalPath.TryDequeue(out var nextOptimal))
{
finished = true;
break;
continue;
}
if (hexMap.Graph.IsCellBlocked(nextOptimal))
@@ -99,6 +96,13 @@ namespace ConsoleApp
_simulationResults.HexUnClearedCells = uncleared;
_simulationResults.HexTotalMoves = totalMoves;
_simulationResults.HexBombsFound = hexBombsFound.Count;
_simulationResults.HexMappedBombs = hexBombsFound.ToList();
foreach (var cell in hexMap.Graph.GetAllCells())
{
if(cell.TerrainType.Id == hexMap.ClearedTerrain.Id)
_simulationResults.HexCoveredCells.Add(cell.Coordinate3.To2D(hexMap.OffsetType));
}
}
private (int, int) CoveredCells()
@@ -137,14 +141,113 @@ namespace ConsoleApp
hexMap.Graph.BlockCells(cellsToBlock);
}
#endregion
#region SquareSimulation
private void SquareSimulation()
{
var squareMap = _mapFactory.GetSquareMap();
_vehicle.CurrentSquareCell = squareMap.StartingCell;
var optimalPath = _pathPlanner.GenerateOptimalSquarePath(squareMap, _vehicle);
var finished = false;
while (!finished)
{
_simulationResults.SquareTotalMoves++;
_simulationResults.SquarePath.Add(_vehicle.CurrentSquareCell);
var detector = squareMap.GetRange(_vehicle.CurrentSquareCell, _vehicle.DetectorRadius);
var detection = CheckForMines(detector);
//Mark cells as covered.
foreach (var cell in detector)
{
cell.Coverage = Coverage.Covered;
}
if (detection)
_reactivePathPlanner.GenerateReactiveSquarePath(squareMap, optimalPath, _vehicle.CurrentSquareCell);
if (_reactivePathPlanner.ReactiveSquarePath.TryDequeue(out var next))
{
_vehicle.CurrentSquareCell = (Cell) next;
}
else
{
if (!optimalPath.TryDequeue(out var current))
{
finished = true;
continue;
}
if (current.Blocked)
{
_reactivePathPlanner.GenerateReactiveSquarePath(squareMap, optimalPath, current);
}
else
_vehicle.CurrentSquareCell = (Cell) current;
}
}
//Debugging information
var (cleared, uncleared) = CoveredSquareCells();
_simulationResults.SquareCellsCleared = cleared;
_simulationResults.SquareCellsUncleared = uncleared;
_simulationResults.SquareBombsFound = squareBombsFound.Count;
_simulationResults.SquareMappedBombs = squareBombsFound.ToList();
foreach (var cell in squareMap.Map)
{
if (cell.Coverage == Coverage.Covered)
{
_simulationResults.SquareCoveredCells.Add(cell);
}
}
}
private (int, int) CoveredSquareCells()
{
var cleared = 0;
var uncleared = 0;
var map = _mapFactory.GetSquareMap();
foreach (var cellState in map.Map)
{
switch (cellState.Coverage)
{
case Coverage.Covered:
cleared++;
break;
case Coverage.Uncovered:
uncleared++;
break;
default:
throw new ArgumentOutOfRangeException();
}
}
return (cleared, uncleared);
}
private bool CheckForMines(List<Cell> detector)
{
var found = false;
foreach (var cell in detector.Where(cell => _mineMap.GetCell(cell.X, cell.Y)))
{
if(!squareBombsFound.Add(cell)) continue;
found = true;
BlockSquareCells(cell);
}
return found;
}
private void BlockSquareCells(Cell cell)
{
var map = _mapFactory.GetSquareMap();
var cellsToBlock = map.GetRange(cell, _vehicle.DetectorRadius);
foreach (var blockCell in cellsToBlock)
{
blockCell.Blocked = true;
}
}
#endregion
}
}

View File

@@ -18,6 +18,15 @@ namespace ConsoleApp
public List<Cell> Mines { get; set; }
public int HexClearedCells { get; set; }
public int HexUnClearedCells { get; set; }
public List<ICell> SquarePath { get; set; }
public List<ICell> SquareMappedBombs { get; set; }
public int SquareCellsUncleared { get; set; }
public int SquareCellsCleared { get; set; }
public int SquareBombsFound { get; set; }
public int SquareTotalMoves { get; set; }
public List<ICell> SquareCoveredCells { get; set; }
public List<Coordinate2D> HexCoveredCells { get; set; }
public SimulationResults()
{
@@ -29,6 +38,15 @@ namespace ConsoleApp
Mines = new List<Cell>();
HexClearedCells = 0;
HexUnClearedCells = 0;
SquarePath = new List<ICell>();
SquareMappedBombs = new List<ICell>();
SquareCellsUncleared = 0;
SquareCellsCleared = 0;
SquareBombsFound = 0;
SquareTotalMoves = 0;
SquareCoveredCells = new List<ICell>();
HexCoveredCells = new List<Coordinate2D>();
}
public void WriteResults()
@@ -37,28 +55,9 @@ namespace ConsoleApp
WriteMines();
WritePaths();
WriteDetectedMines();
GenerateImages();
WriteCoveredCells();
}
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()
{
@@ -71,9 +70,19 @@ namespace ConsoleApp
tw.WriteLine($"\t Bombs Found: {HexBombsFound}");
tw.WriteLine($"\t Cleared Cell Count: {HexClearedCells}");
tw.WriteLine($"\t Uncleared Cell Count: {HexUnClearedCells}");
tw.WriteLine($"\t Percentage Cleared: {(double)HexClearedCells/(HexClearedCells+HexUnClearedCells)*100}");
tw.WriteLine($"Square: ");
tw.WriteLine($"\t Total Moves: {SquareTotalMoves}");
tw.WriteLine($"\t Bombs Found: {SquareBombsFound}");
tw.WriteLine($"\t Cleared Cell Count: {SquareCellsCleared}");
tw.WriteLine($"\t Uncleared Cell Count: {SquareCellsUncleared}");
tw.WriteLine($"\t Percentage Cleared: {(double) SquareCellsCleared / (SquareCellsCleared + SquareCellsUncleared)*100}");
}
}
private void WriteMines()
{
using(TextWriter tw = new StreamWriter("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/Mines.txt"))
@@ -83,11 +92,30 @@ namespace ConsoleApp
}
}
private void WriteCoveredCells()
{
using(TextWriter tw = new StreamWriter("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/HexCoveredCells.txt"))
{
foreach (var s in HexCoveredCells)
tw.WriteLine($"{s.X} {s.Y}");
}
using(TextWriter tw = new StreamWriter("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/SquareCoveredCells.txt"))
{
foreach (var s in SquareCoveredCells)
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)
foreach (var s in HexMappedBombs)
tw.WriteLine($"{s.X} {s.Y}");
}
using(TextWriter tw = new StreamWriter("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/SquareDetectedMines.txt"))
{
foreach (var s in SquareMappedBombs)
tw.WriteLine($"{s.X} {s.Y}");
}
}
@@ -96,9 +124,15 @@ namespace ConsoleApp
{
using(TextWriter tw = new StreamWriter("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/HexPath.txt"))
{
foreach (Coordinate2D s in HexPath)
foreach (var s in HexPath)
tw.WriteLine($"{s.X} {s.Y}");
}
using(TextWriter tw = new StreamWriter("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/SquarePath.txt"))
{
foreach (var s in SquarePath)
tw.WriteLine($"{s.X} {s.Y}");
}
}
}
}

View File

@@ -24,18 +24,18 @@ namespace ConsoleApp
public (int width, int height) GetMapDimensions()
{
Console.WriteLine($"Enter map width: ");
Console.WriteLine($"Enter map width (5-15) meters: ");
var x = GetUserInput();
if (!int.TryParse(x, out var width))
if (!int.TryParse(x, out var width) && width >= 5 && width <= 15)
{
PrintInvalidInput();
GetMapDimensions();
}
Console.WriteLine($"Enter map height: ");
Console.WriteLine($"Enter map height (5-15) meters: ");
var y = GetUserInput();
if (int.TryParse(y, out var height)) return (width, height);
if (int.TryParse(y, out var height) && height >= 5 && height <= 15) return (width, height);
PrintInvalidInput();
GetMapDimensions();
return (width, height);

107
ConsoleApp/plotGraphs.py Normal file
View File

@@ -0,0 +1,107 @@
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
if __name__ == "__main__":
xc = []
yc = []
xm = []
ym = []
xf = []
yf = []
sxc = []
syc = []
sxm = []
sym = []
sxf = []
syf = []
sccx = []
sccy = []
hccx = []
hccy = []
with open("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/SquareCoveredCells.txt") as c:
for line in c:
x, y = line.split()
sccx.append(int(x))
sccy.append(int(y))
with open("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/SquareDetectedMines.txt") as c:
for line in c:
x, y = line.split()
sxf.append(int(x))
syf.append(int(y))
with open("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/HexCoveredCells.txt") as c:
for line in c:
x, y = line.split()
hccx.append(int(x))
hccy.append(int(y))
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/SquarePath.txt") as c:
for line in c:
x, y = line.split()
sxc.append(int(x))
syc.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(1)
plt.plot(xc, yc, 'h', label='vehicle', color='blue', linestyle='None')
plt.plot(xm, ym, 'h', label='all mines', color='red', linestyle='None')
plt.plot(xf, yf, 'h', label='detected mines', color='orange', linestyle='None')
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.plot()
plt.close(fig)
fig = plt.figure(2)
plt.plot(sxc, syc, 's', label='vehicle', color='blue', linestyle='None')
plt.plot(sxm, sym, 's', label='all mines', color='red', linestyle='None')
plt.plot(sxf, syf, 's', label='detected mines', color='orange', linestyle='None')
plt.title('Square Simulation')
plt.legend(loc='lower left', fontsize='xx-small')
matplotlib.pyplot.savefig('/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/SquareTest.png')
plt.plot()
plt.close(fig)
fig = plt.figure(3)
plt.plot(hccx, hccy, 'h', label='covered cells', color='red', linestyle='None')
plt.plot(xf, yf, 'h', label='detected mines', color='blue', linestyle='None')
plt.title('Hex Coverage')
plt.legend(loc='lower left', fontsize='xx-small')
matplotlib.pyplot.savefig('/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/HexCoverage.png')
plt.plot()
plt.close(fig)
fig = plt.figure(4)
plt.plot(sccx, sccy, 's', label='covered cells', color='red', linestyle='None')
plt.plot(sxf, syf, 's', label='detected mines', color='blue', linestyle='None')
plt.title('Square Coverage')
plt.legend(loc='lower left', fontsize='xx-small')
matplotlib.pyplot.savefig('/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/SquareCoverage.png')
plt.plot()
plt.close(fig)