I think its done

This commit is contained in:
2020-12-16 17:19:25 -07:00
parent a792de99f3
commit e335ce3c68
34 changed files with 5679 additions and 927 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -15,6 +15,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,10 +39,19 @@
</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.zip" t="Include" />
<e p="PathPlanners" t="Include">
<e p="IPathPlanner.cs" t="Include" />
<e p="IReactivePathPlanner.cs" t="Include" />

View File

@@ -18,21 +18,30 @@
</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 afterPath="$PROJECT_DIR$/ConsoleApp/Maps/AstarSquareSearch.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/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/HexPlot.py" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/HexPlot.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/ISimulationResults.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/ISimulationResults.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/Cell.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/Cell.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/ICell.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/ICell.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/ISquareMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/ISquareMap.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/MapExtensions.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/MapExtensions.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Output/Data.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Output/Data.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/PathPlanners/IReactivePathPlanner.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/PathPlanners/IReactivePathPlanner.cs" 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/PathPlanners/ReactivePathPlanner.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/PathPlanners/ReactivePathPlanner.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/Sim/DetectionHead.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Sim/DetectionHead.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Sim/IVehicle.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Sim/IVehicle.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Sim/Vehicle.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Sim/Vehicle.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Sim/VehicleConfiguration.json" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Sim/VehicleConfiguration.json" 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/SimulationResults.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/SimulationResults.cs" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -50,38 +59,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 +71,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 +106,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/ISimulationResults.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/Program.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/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/HexPlot.py" />
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs" />
</changedPaths>
</component>
<component name="ProjectId" id="1lIZ7IfsUjzqV2Jb1obOFvGFAfp" />
@@ -156,7 +152,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.22377622" />
<property name="DebuggerViewTab_PTCS_LastProportionKey" value="0.0" />
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
@@ -222,7 +218,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="13487000" />
</task>
<servers />
</component>
@@ -247,33 +245,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

@@ -10,12 +10,51 @@ if __name__ == "__main__":
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()
@@ -27,13 +66,44 @@ if __name__ == "__main__":
x, y = line.split()
xf.append(int(x))
yf.append(int(y))
fig = plt.figure()
fig = plt.figure(1)
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.plot()
plt.close(fig)
fig = plt.figure(2)
plt.plot(sxc, syc)
plt.plot(sxc, syc, 'o', label='vehicle', color='blue')
plt.plot(sxm, sym, 'o', label='all mines', color='red')
plt.plot(sxf, syf, 'o', label='detected mines', color='orange')
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, 'o', label='covered cells', color='red')
plt.plot(xf, xy, 'o', label='detected mines', color='blue')
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, 'o', label='covered cells', color='red')
plt.plot(sxf, syf, 'o', label='detected mines', color='blue')
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)

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];
}
}
}

View File

@@ -1,7 +1,14 @@
General:
Total Mines: 23
Hex:
Total Moves: 927
Total Moves: 420
Bombs Found: 23
Cleared Cell Count: 2295
Uncleared Cell Count: 9
Cleared Cell Count: 2263
Uncleared Cell Count: 41
Percentage Cleared: 98.22048611111111
Square:
Total Moves: 553
Bombs Found: 20
Cleared Cell Count: 1996
Uncleared Cell Count: 308
Percentage Cleared: 86.63194444444444

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,23 @@
39 7
17 8
12 11
5 10
12 14
16 20
27 14
31 20
32 14
35 25
33 22
21 19
20 21
15 23
9 29
34 26
37 26
35 37
35 36
34 36
29 38
10 36
20 42

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@@ -0,0 +1,23 @@
32 14
20 42
27 14
12 14
34 26
9 29
10 36
31 20
34 36
15 23
5 10
33 22
35 37
16 20
37 26
12 11
39 7
29 38
35 36
20 21
21 19
35 25
17 8

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,20 @@
39 7
17 8
12 11
5 10
12 14
16 20
15 23
9 29
10 36
20 21
21 19
27 14
31 20
33 22
34 26
37 26
35 25
20 42
35 37
29 38

View File

@@ -0,0 +1,553 @@
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
46 1
46 2
46 3
46 4
46 5
46 6
46 7
46 8
45 8
44 8
43 8
42 8
43 8
43 9
43 10
42 10
42 11
41 11
40 11
39 11
38 11
37 11
36 11
35 11
35 10
35 9
35 8
34 8
33 8
32 8
31 8
30 8
29 8
28 8
27 8
26 8
25 8
24 8
23 8
22 8
21 8
20 8
21 8
21 7
21 6
21 5
21 4
20 4
19 4
18 4
17 4
16 4
15 4
14 4
13 4
13 5
13 6
13 7
13 8
13 7
12 7
11 7
10 7
9 7
9 8
8 8
8 7
8 6
7 6
6 6
5 6
4 6
3 6
2 6
1 6
1 7
1 8
0 8
0 9
0 10
0 11
0 12
0 13
0 14
0 15
0 16
1 16
2 16
3 16
4 16
5 16
6 16
7 16
8 16
9 16
9 17
9 18
10 18
11 18
12 18
13 18
12 18
12 19
12 20
12 21
11 21
11 22
11 23
11 24
11 25
11 26
11 25
10 25
9 25
8 25
7 25
6 25
5 25
5 26
5 27
5 28
5 29
5 30
5 31
5 32
6 32
6 33
7 33
8 33
7 33
6 33
6 34
6 35
6 36
6 37
6 38
6 39
7 39
7 40
8 40
9 40
10 40
11 40
12 40
13 40
13 39
14 39
14 38
14 37
14 36
14 35
14 34
14 33
14 32
14 31
14 30
14 29
15 29
15 28
15 27
16 27
17 27
18 27
18 26
19 26
19 25
19 24
19 25
20 25
21 25
22 25
23 25
23 24
24 24
24 23
24 22
24 21
25 21
25 20
25 19
25 18
25 17
25 18
26 18
27 18
28 18
27 18
27 19
27 20
27 21
27 22
27 23
28 23
28 24
29 24
30 24
30 25
30 26
30 27
30 28
31 28
31 29
31 30
31 31
31 32
32 32
33 32
34 32
34 31
35 31
35 30
36 30
37 30
37 29
37 30
38 30
39 30
40 30
41 30
41 29
41 28
41 27
41 26
41 25
41 24
41 23
40 23
40 22
39 22
38 22
37 22
37 21
37 20
37 19
37 18
36 18
36 17
36 16
37 16
38 16
39 16
40 16
41 16
42 16
43 16
44 16
45 16
46 16
46 17
46 18
46 19
46 20
46 21
46 22
46 23
46 24
45 24
44 24
43 24
42 24
41 24
41 24
41 24
41 25
41 26
41 27
41 28
41 29
40 29
40 30
39 30
38 30
37 30
36 30
35 30
34 30
33 30
32 30
31 30
30 30
29 30
29 29
29 28
29 27
29 26
29 25
29 24
28 24
27 24
26 24
25 24
24 24
23 24
23 24
22 25
22 26
22 27
22 28
22 29
22 30
21 30
21 31
20 31
19 31
19 32
18 32
18 33
18 34
18 35
18 36
18 37
18 38
18 39
17 39
16 39
16 40
16 41
16 42
16 43
16 44
15 44
14 44
13 44
12 44
11 44
10 44
9 44
8 44
7 44
6 44
5 44
5 43
5 42
5 41
5 40
5 39
5 38
5 37
5 36
5 35
5 34
5 33
5 32
5 31
5 30
5 29
5 28
5 27
5 26
5 25
5 24
6 24
7 24
8 24
9 24
10 24
9 24
8 24
7 24
6 24
5 24
4 24
3 24
2 24
1 24
0 24
0 25
0 26
0 27
0 28
0 29
0 30
0 31
0 32
1 32
2 32
3 32
4 32
5 32
6 32
6 32
6 32
6 33
6 34
6 35
6 36
6 37
6 38
6 39
7 39
7 40
8 40
9 40
10 40
11 40
12 40
13 40
13 39
14 39
14 38
14 37
14 36
14 35
14 34
14 33
13 33
13 32
12 32
13 32
14 32
15 32
16 32
17 32
18 32
19 32
20 32
21 32
22 32
23 32
24 32
25 32
26 32
27 32
28 32
29 32
30 32
31 32
32 32
33 32
34 32
35 32
36 32
37 32
38 32
39 32
40 32
41 32
42 32
43 32
44 32
45 32
46 32
46 33
46 34
46 35
46 36
46 37
46 38
46 39
46 40
45 40
44 40
43 40
42 40
41 40
40 40
39 40
38 40
37 40
37 41
36 41
35 41
34 41
33 41
32 41
32 40
32 41
32 42
31 42
30 42
29 42
28 42
27 42
26 42
25 42
25 41
25 40
24 40
24 40
23 39
23 38
22 38
21 38
20 38
19 38
18 38
17 38
16 38
16 39
16 40
15 40
14 40
13 40
12 40
11 40
10 40
9 40
8 40
7 40
6 40
5 40
4 40
3 40
2 40
1 40
0 40

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 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");
}
@@ -49,6 +50,26 @@ namespace ConsoleApp
mapFactory.GenerateMaps(x, y, minePercentage);
simRunner.Run();
}
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);
}
}
}
}

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}");
}
}
}
}