Getting close

This commit is contained in:
2020-12-16 04:02:37 -07:00
parent cf432a348b
commit f8ce6d0c83
27 changed files with 587 additions and 163 deletions

View File

@@ -34,12 +34,19 @@
</e>
</e>
</e>
<e p="Output" t="Include">
<e p="DetectedMines.txt" t="Include" />
<e p="Mines.txt" t="Include" />
<e p="SavedList.txt" t="Include" />
<e p="test.png" t="Include" />
</e>
<e p="PathPlanners" t="Include">
<e p="IPathPlanner.cs" t="Include" />
<e p="IReactivePathPlanner.cs" t="Include" />
<e p="PathPlanner.cs" t="Include" />
<e p="ReactivePathPlanner.cs" t="Include" />
</e>
<e p="plot.py" t="Include" />
<e p="Program.cs" t="Include" />
<e p="Sim" t="Include">
<e p="DetectionHead.cs" t="Include" />

View File

@@ -18,29 +18,29 @@
</component>
<component name="ChangeListManager">
<list default="true" id="dafcaeb7-80aa-43a3-a480-786fafb78c0b" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/ConsoleApp/Maps/IMineMap.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ConsoleApp/Maps/MapExtensions.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ConsoleApp/Maps/MineMap.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ConsoleApp/PathPlanners/IReactivePathPlanner.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ConsoleApp/PathPlanners/ReactivePathPlanner.cs" afterDir="false" />
<change afterPath="$PROJECT_DIR$/ConsoleApp/plot.py" 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/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/HexMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/IHexMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/IHexMap.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/IMapFactory.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/IMapFactory.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/IMineMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/IMineMap.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/MapExtensions.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/MapExtensions.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/MapFactory.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/MapFactory.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/PathPlanners/IPathPlanner.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/PathPlanners/IPathPlanner.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/Maps/SquareMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.cs" 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.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Sim/VehicleConfiguration.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/UserConsole.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/UserConsole.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Vehicle/DetectionHead.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Sim/DetectionHead.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Vehicle/IVehicle.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Sim/IVehicle.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Vehicle/Vehicle.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Sim/Vehicle.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Vehicle/VehicleConfiguration.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Sim/VehicleConfiguration.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Vehicle/VehicleConfiguration.json" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Sim/VehicleConfiguration.json" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -58,31 +58,56 @@
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="HighlightingSettingsPerFile">
<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="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/DecompilerCache/decompiler/EE5CA5D4-EDEB-48AE-9C0D-FE354330FB77/84/4eb9c798/GraphUtils.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="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="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/8B2EA1A3-95EB-49F7-AF97-CA55CE776F10/4/Container.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="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="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/EE5CA5D4-EDEB-48AE-9C0D-FE354330FB77/14/12025305/MovementTypes.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/EE5CA5D4-EDEB-48AE-9C0D-FE354330FB77/0b/0953c23b/GraphFactory.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/DecompilerCache/decompiler/EE5CA5D4-EDEB-48AE-9C0D-FE354330FB77/84/4eb9c798/GraphUtils.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/8B2EA1A3-95EB-49F7-AF97-CA55CE776F10/4/Container.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/EB067793-5C3F-4219-AEF1-3AB117C20649/B5/Random.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$APPLICATION_CONFIG_DIR$/resharper-host/SourcesCache/1C5C65AB-6C84-402C-B333-F3A5A7121EFE/D/Queue.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///Dummy.cs" root0="SKIP_HIGHLIGHTING" />
</component>
<component name="IdeDocumentHistory">
<changedPaths>
@@ -95,34 +120,37 @@
<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/IHexMap.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.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/Sim/DetectionHead.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/Sim/Vehicle.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Sim/VehicleConfiguration.json" />
<option value="$PROJECT_DIR$/ConsoleApp/CoreModule.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/UserConsole.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Program.cs" />
<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/MineMap.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IMineMap.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/MapFactory.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IMapFactory.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/IReactivePathPlanner.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/Program.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/MineMap.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/plot.py" />
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/ReactivePathPlanner.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" />
</changedPaths>
</component>
<component name="ProjectId" id="1lIZ7IfsUjzqV2Jb1obOFvGFAfp" />
@@ -140,7 +168,7 @@
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="nodejs_package_manager_path" value="npm" />
<property name="restartRequiresConfirmation" value="false" />
<property name="settings.editor.selected.configurable" value="project.propDebugger" />
<property name="settings.editor.selected.configurable" value="configurable.group.build" />
<property name="vue.rearranger.settings.migration" value="true" />
</component>
<component name="RunManager" selected=".NET Project.ConsoleApp">
@@ -200,7 +228,7 @@
<workItem from="1607982179018" duration="634000" />
<workItem from="1607983288378" duration="86000" />
<workItem from="1607983862958" duration="7777000" />
<workItem from="1607993290571" duration="36241000" />
<workItem from="1607993290571" duration="69552000" />
</task>
<servers />
</component>
@@ -240,33 +268,18 @@
</properties>
<option name="timeStamp" value="24" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DotNet Breakpoints">
<url>file://$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs</url>
<line>87</line>
<properties documentPath="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs" initialLine="87" containingFunctionPresentation="method 'GenerateOptimalHexPath'">
<startOffsets>
<option value="3651" />
</startOffsets>
<endOffsets>
<option value="3667" />
</endOffsets>
</properties>
<option name="timeStamp" value="44" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DotNet Breakpoints">
<url>file://$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs</url>
<line>85</line>
<properties documentPath="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs" initialLine="85" containingFunctionPresentation="method 'GenerateOptimalHexPath'">
<startOffsets>
<option value="3546" />
</startOffsets>
<endOffsets>
<option value="3612" />
</endOffsets>
</properties>
<option name="timeStamp" value="46" />
</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>

View File

@@ -22,6 +22,13 @@
<None Update="Sim\VehicleConfiguration.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="plot.py">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Output" />
</ItemGroup>
</Project>

View File

@@ -17,6 +17,9 @@ namespace ConsoleApp.Maps
public OffsetTypes OffsetType { get; }
public MovementType DefaultMovement { get; }
public TerrainType ClearedTerrain { get; }
public TerrainType UnclearedTerrain { get; }
/// <summary>
@@ -28,35 +31,28 @@ namespace ConsoleApp.Maps
{
//Set Offset Type for 2d -> 3d conversion
OffsetType = OffsetTypes.OddRowsRight;
//convert to cm
x *= 100;
y *= 100;
//calculate number of cells on x and y axis
var xCellCount = (int)Math.Ceiling((decimal) (x) / 25);
var yCellCount = (int)Math.Ceiling((decimal) (y) / 25);
Height = yCellCount;
Width = xCellCount;
Height = y;
Width = x;
var unclearedTerrain = new TerrainType(1, "uncleared");
var clearedTerrain = new TerrainType(2, "cleared");
UnclearedTerrain = new TerrainType(1, "uncleared");
ClearedTerrain = new TerrainType(2, "cleared");
DefaultMovement = new MovementType(1, "default");
var movementTypes = new MovementTypes(
new ITerrainType[] { unclearedTerrain, clearedTerrain },
new ITerrainType[] { UnclearedTerrain, ClearedTerrain },
new Dictionary<IMovementType, Dictionary<ITerrainType, int>>
{
[DefaultMovement] = new Dictionary<ITerrainType, int>
{
[unclearedTerrain] = 1,
[clearedTerrain] = 2
[UnclearedTerrain] = 1,
[ClearedTerrain] = 2
}
}
);
Graph = GraphFactory.CreateRectangularGraph(Width, Height, movementTypes, unclearedTerrain);
Graph = GraphFactory.CreateRectangularGraph(Width, Height, movementTypes, UnclearedTerrain);
}
}
}

View File

@@ -9,5 +9,7 @@ namespace ConsoleApp.Maps
int Width { get; }
int Height { get; }
MovementType DefaultMovement { get; }
public TerrainType ClearedTerrain { get; }
public TerrainType UnclearedTerrain { get; }
}
}

View File

@@ -7,7 +7,6 @@ namespace ConsoleApp.Maps
{
int Height { get; }
int Width { get; }
int CellWidth { get; }
void GenerateMaps(int x, int y, double minePercentage);
IHexMap GetHexMap();
ISquareMap GetSquareMap();

View File

@@ -3,5 +3,8 @@ namespace ConsoleApp.Maps
public interface IMineMap
{
bool[,] Map { get; }
int TotalBombs { get; }
bool GetCell(int x, int y);
}
}

View File

@@ -15,6 +15,5 @@ namespace ConsoleApp.Maps
}
}
}
}
}

View File

@@ -10,7 +10,6 @@ namespace ConsoleApp.Maps
private int _defaultWidth;
public int Height { get; protected set; }
public int Width { get; protected set; }
public int CellWidth { get; }
@@ -22,11 +21,17 @@ namespace ConsoleApp.Maps
public void GenerateMaps(int x, int y, double minePercentage)
{
Width = x;
Height = y;
_squareMap = new SquareMap(x, y);
_hexMap = new HexMap(x, y);
_mineMap = new MineMap(x, y, minePercentage);
//convert to cm
x *= 100;
y *= 100;
//calculate number of cells on x and y axis
var xCellCount = (int)Math.Ceiling((decimal) (x) / 25);
var yCellCount = (int)Math.Ceiling((decimal) (y) / 25);
Width = xCellCount;
Height = yCellCount;
_squareMap = new SquareMap(xCellCount, yCellCount);
_hexMap = new HexMap(xCellCount, yCellCount);
_mineMap = new MineMap(xCellCount, yCellCount, minePercentage);
}
public IHexMap GetHexMap() => _hexMap ?? throw new NullReferenceException("hex map not initialized");
public ISquareMap GetSquareMap() => _squareMap ?? throw new NullReferenceException("square map not initialized");
@@ -34,7 +39,6 @@ namespace ConsoleApp.Maps
public MapFactory(IVehicle vehicle)
{
CellWidth = vehicle.Width/2;
_defaultHeight = 0;
_defaultWidth = 0;
Height = _defaultHeight;

View File

@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using HexCore;
namespace ConsoleApp.Maps
{
@@ -9,24 +11,44 @@ namespace ConsoleApp.Maps
private int _x;
private int _y;
public bool[,] Map { get; }
public int TotalBombs { get; }
private List<Cell> _placedMines;
public MineMap(int x, int y, double minePercentage)
{
_x = x;
_y = y;
_mineCount = x*y*((int)minePercentage/100);
_placedMines = new List<Cell>();
_mineCount = (int)(x*y*(minePercentage/100));
TotalBombs = _mineCount;
Map = new bool[x, y];
Map.Fill2DArray(false);
PlaceMines();
using(TextWriter tw = new StreamWriter("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/Mines.txt"))
{
foreach (var s in _placedMines)
tw.WriteLine($"{s.X} {s.Y}");
}
}
public bool GetCell(int x, int y) => Map[x,y];
private void PlaceMines()
{
var rand = new Random();
for (int i = 0; i < _mineCount; i++)
for (var i = 0; i < _mineCount; i++)
{
var x = rand.Next(_x);
var y = rand.Next(_y);
Map[x, y] = true;
var x = rand.Next(5,_x-5);
var y = rand.Next(5,_y-5);
if (Map[x, y] == true)
{
i--;
}
else
{
Map[x, y] = true;
_placedMines.Add(new Cell(x,y));
}
}
}
}

View File

@@ -19,26 +19,21 @@ namespace ConsoleApp.Maps
/// <param name="y"></param>
public SquareMap(int x, int y)
{
//convert to cm
x *= 100;
y *= 100;
//calculate number of cells on x and y axis
var xCellCount = (int)Math.Ceiling((decimal) (x) / 25);
var yCellCount = (int)Math.Ceiling((decimal) (y) / 25);
//set Width and height Properties
Width = xCellCount-1;
Height = yCellCount-1;
Width = x-1;
Height = y-1;
//Initialize Map
Map = new Cell[xCellCount, yCellCount];
Map = new Cell[x, y];
//set last cell;
StartingCell = Map[0, 0];
for (int i = 0; i < xCellCount; i++)
for (int i = 0; i < x; i++)
{
for (int j = 0; j < yCellCount; j++)
for (int j = 0; j < y; j++)
{
Map[i,j] = new Cell(i, j);
}

View File

@@ -0,0 +1,7 @@
8 5
8 6
5 11
9 10
13 9
13 14
10 13

View File

@@ -0,0 +1,8 @@
5 11
8 6
13 14
9 10
13 9
10 13
10 6
8 5

View File

@@ -0,0 +1,150 @@
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
19 1
19 2
19 3
18 3
17 3
16 3
15 3
14 3
13 3
12 3
11 3
10 3
9 3
9 2
8 2
7 2
6 3
5 3
4 3
3 3
2 3
1 3
0 3
1 4
0 5
0 6
1 6
2 6
3 6
4 6
5 6
6 6
5 7
6 8
6 9
7 9
14 6
15 6
16 6
17 6
18 6
19 6
19 7
19 8
19 9
18 9
17 9
16 9
15 9
16 10
15 11
15 12
14 12
15 12
15 13
16 14
15 15
15 16
14 17
13 17
12 17
11 17
11 16
10 15
10 16
9 16
8 15
8 14
7 13
6 14
5 14
4 14
3 13
3 12
2 11
3 10
3 9
1 9
0 9
1 10
0 11
0 12
1 12
2 12
3 12
3 13
4 14
4 15
5 16
5 17
6 17
7 17
8 17
9 17
10 17
11 17
12 17
13 17
14 17
15 16
15 15
16 14
15 13
15 12
17 12
18 12
19 12
19 13
19 14
19 15
18 15
17 15
16 15
15 15
15 16
14 17
13 17
12 17
11 17
11 16
10 16
9 16
8 15
6 15
5 15
4 15
3 15
2 15
1 15
0 15

BIN
ConsoleApp/Output/test.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using ConsoleApp.Maps;
using HexCore;
namespace ConsoleApp.PathPlanners
@@ -6,5 +7,6 @@ namespace ConsoleApp.PathPlanners
public interface IReactivePathPlanner
{
Queue<Coordinate2D> ReactiveHexPath { get; }
void GenerateReactiveHexPath(IHexMap hexMap, Queue<Coordinate2D> optimalPath, Coordinate2D vehicleCurrentHexCell);
}
}

View File

@@ -55,7 +55,7 @@ namespace ConsoleApp.PathPlanners
return path;
}
public Queue<Coordinate2D> GenerateOptimalHexPath(IHexMap hexMap, IVehicle vehicle)
{
var currentPostion = vehicle.CurrentHexCell;
@@ -64,55 +64,44 @@ namespace ConsoleApp.PathPlanners
var path = new List<Coordinate2D>();
while (!finished)
{
//Heading East
if (currentHeading == GlobalDirection.East)
{
path.AddRange(hexMap.Graph.GetShortestPath(
currentPostion,
new Coordinate2D(hexMap.Width, currentPostion.Y, hexMap.OffsetType),
new Coordinate2D(hexMap.Width-1, currentPostion.Y, hexMap.OffsetType),
hexMap.DefaultMovement));
currentPostion = new Coordinate2D(hexMap.Width, currentPostion.Y, hexMap.OffsetType);
currentPostion = new Coordinate2D(hexMap.Width-1, currentPostion.Y, hexMap.OffsetType);
}
else if(currentHeading == GlobalDirection.West)
//Heading West
else if (currentHeading == GlobalDirection.West)
{
path.AddRange(hexMap.Graph.GetShortestPath(
currentPostion,
new Coordinate2D(0, currentPostion.Y, hexMap.OffsetType),
hexMap.DefaultMovement));
currentPostion = new Coordinate2D(0, currentPostion.Y, hexMap.OffsetType);
}
if (currentPostion.Y + vehicle.DetectorRadius * 2 > hexMap.Height)
//Check for finish
if (currentPostion.Y + (vehicle.DetectorRadius * 2) >= hexMap.Height - 1)
{
finished = true;
break;
}
Coordinate2D tmpPosition;
if(currentHeading == GlobalDirection.East)
tmpPosition = new Coordinate3D(
currentPostion.To3D().X-1,
currentPostion.To3D().Y,
currentPostion.To3D().Z+1).To2D(hexMap.OffsetType);
else
tmpPosition = new Coordinate3D(
currentPostion.To3D().X,
currentPostion.To3D().Y-1,
currentPostion.To3D().Z+1).To2D(hexMap.OffsetType);
while (hexMap.Graph.GetRange(currentPostion, vehicle.DetectorRadius*2).Contains(tmpPosition))
//Move Up edges of map
var tmpPosition = currentPostion;
var range = hexMap.Graph.GetRange(currentPostion, vehicle.DetectorRadius * 2);
for (var i = currentPostion.Y; i < currentPostion.Y + vehicle.DetectorRadius * 2; i++)
{
if(currentHeading == GlobalDirection.East)
tmpPosition = new Coordinate3D(
tmpPosition.To3D().X-1,
tmpPosition.To3D().Y,
tmpPosition.To3D().Z+1).To2D(hexMap.OffsetType);
else
tmpPosition = new Coordinate3D(
tmpPosition.To3D().X,
tmpPosition.To3D().Y-1,
tmpPosition.To3D().Z+1).To2D(hexMap.OffsetType);
var newCoord = new Coordinate2D(currentPostion.X, i, hexMap.OffsetType);
if (range.Contains(newCoord))
tmpPosition = newCoord;
}
path.AddRange(hexMap.Graph.GetShortestPath(
currentPostion,
tmpPosition,
@@ -122,9 +111,11 @@ namespace ConsoleApp.PathPlanners
currentHeading = GlobalDirection.West;
else
currentHeading = GlobalDirection.East;
}
return new Queue<Coordinate2D>(path);
}
}

View File

@@ -1,20 +1,44 @@
using System.Collections.Generic;
using ConsoleApp.Maps;
using HexCore;
namespace ConsoleApp.PathPlanners
{
public class ReactivePathPlanner : IReactivePathPlanner
{
public Queue<Coordinate2D> ReactiveHexPath { get; }
private Queue<Coordinate2D> _reactiveHexPath;
public Queue<Coordinate2D> ReactiveHexPath => _reactiveHexPath;
public ReactivePathPlanner()
{
ReactiveHexPath = new Queue<Coordinate2D>();
_reactiveHexPath = new Queue<Coordinate2D>();
}
public void GenerateReactiveHexPath(Graph graph, ref List<Coordinate3D> optimalPath, Coordinate2D minePosition)
public void GenerateReactiveHexPath(IHexMap hexMap, Queue<Coordinate2D> optimalPath,
Coordinate2D vehicleCurrentHexCell)
{
//Clean out any old path
_reactiveHexPath.Clear();
//If the optimal path is empty well we are done, otherwise pop 1
if (!optimalPath.TryDequeue(out var convergentPoint))
return;
//Dequeue until the cell is not blocked
while (hexMap.Graph.IsCellBlocked(convergentPoint))
{
//if optimal path is empty were done and we can not clear around this position, otherwise
//lest pop another.
if (!optimalPath.TryDequeue(out convergentPoint))
return;
}
var reactivePath = hexMap.Graph.GetShortestPath(vehicleCurrentHexCell, convergentPoint, hexMap.DefaultMovement);
foreach (var node in reactivePath)
{
_reactiveHexPath.Enqueue(node);
}
}
}
}

View File

@@ -1,4 +1,8 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Threading;
using ConsoleApp.Maps;
namespace ConsoleApp
@@ -13,9 +17,33 @@ namespace ConsoleApp
_bootstrapper = BootStrapper.BootstrapSystem(new CoreModule());
_userConsole = new UserConsole();
Initialization();
GenerateImages();
Console.WriteLine("Program Completed");
}
private static void GenerateImages()
{
// var generateMap= "python3 ConsoleApp/plot.py";
// System.Diagnostics.Process.Start("CMD.exe",generateMap);
//
var file = Path.Combine("./",Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"plot.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 static void Initialization()
{
_userConsole.PrintStartMenu();

View File

@@ -10,7 +10,16 @@ namespace ConsoleApp.Sim
Graph graph,
Coordinate2D centerCoordinate,
int detectorRadius,
GlobalDirection direction) => graph.GetRange(centerCoordinate, detectorRadius);
int vehicleTurnRadius)
{
var detectorCells = graph.GetRange(centerCoordinate, detectorRadius);
// var vehicleCells = graph.GetRange(centerCoordinate, vehicleTurnRadius);
// foreach (var vehicleCell in vehicleCells)
// {
// detectorCells.Remove(vehicleCell);
// }
return detectorCells;
}
public static List<Cell> GetCoveredCells(
ISquareMap squareMap,

View File

@@ -1,4 +1,5 @@
using ConsoleApp.Maps;
using HexCore;
namespace ConsoleApp.Sim
{
@@ -6,11 +7,9 @@ namespace ConsoleApp.Sim
{
int Length { get; }
int Width { get; }
int DetectorOffset { get;}
int TurnRadius { get; }
int DetectorRadius { get;}
HexCore.Coordinate2D CurrentHexCell { get; set; }
Heading HexHeading { get; set; }
Heading SquareHeading { get; set; }
Coordinate2D CurrentHexCell { get; set; }
ICell CurrentSquareCell { get; set; }
}
}

View File

@@ -1,3 +1,5 @@
using System;
using System.Collections.Generic;
using ConsoleApp.Maps;
namespace ConsoleApp.Sim
@@ -6,12 +8,9 @@ namespace ConsoleApp.Sim
{
public int Length { get; }
public int Width { get; }
public int DetectorOffset { get;}
public int TurnRadius { get; }
public int DetectorRadius { get;}
public HexCore.Coordinate2D CurrentHexCell { get; set; }
public Heading HexHeading { get; set; }
public Heading SquareHeading { get; set; }
public ICell CurrentSquareCell { get; set; }
@@ -20,12 +19,17 @@ namespace ConsoleApp.Sim
public Vehicle(IJsonDeserializor jsonDeserializor)
{
var config = jsonDeserializor.DeserializeObject<VehicleConfiguration>("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Sim/VehicleConfiguration.json");
Length = config.Length;
Width = config.Width;
DetectorRadius = config.DetectorRadius;
DetectorOffset = config.DetectorOffset;
CurrentHexCell = default;
CurrentSquareCell = default;
var length = config.Length;
length *= 100;
Length = (int)Math.Ceiling((decimal)length/ 25);
var width = config.Width;
width *= 100;
Width = (int)Math.Ceiling((decimal)width/ 25);
DetectorRadius = (int)Math.Floor(((decimal)config.DetectorRadius * 100)/25)/2;
TurnRadius = (int)Math.Ceiling(Math.Sqrt(Math.Pow(config.Length, 2) * Math.Pow(config.Width, 2))/2);
// if (DetectorRadius <= TurnRadius)
// throw new ArgumentException("Detection radius must be larger than the vehicle turn radius");
}
}
}

View File

@@ -5,6 +5,5 @@ namespace ConsoleApp.Sim
public int Length { get; set; }
public int Width { get; set; }
public int DetectorRadius { get; set; }
public int DetectorOffset { get; set; }
}
}

View File

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

View File

@@ -1,11 +1,16 @@
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
{
@@ -14,16 +19,15 @@ namespace ConsoleApp
private IMapFactory _mapFactory;
private IVehicle _vehicle;
private int _cellWidth;
private IPathPlanner _pathPlanner;
private IMineMap _mineMap;
private IReactivePathPlanner _reactivePathPlanner;
private HashSet<Coordinate2D> hexBombsFound = new HashSet<Coordinate2D>();
private List<Coordinate2D> testingPath = new List<Coordinate2D>();
public SimRunner(IMapFactory mapFactory, IVehicle vehicle, IPathPlanner pathPlanner, IReactivePathPlanner reactivePathPlanner)
{
_cellWidth = mapFactory.CellWidth;
_mapFactory = mapFactory;
_vehicle = vehicle;
_pathPlanner = pathPlanner;
@@ -44,9 +48,123 @@ namespace ConsoleApp
var hexMap = _mapFactory.GetHexMap();
_vehicle.CurrentHexCell = new Coordinate2D(0, 0, OffsetTypes.OddRowsRight);
var optimalPath = _pathPlanner.GenerateOptimalHexPath(hexMap, _vehicle);
var reactivePath = _reactivePathPlanner.ReactiveHexPath;
var minimumMoves = optimalPath.Count;
var finished = false;
var totalMoves = 0;
while (!finished)
{
totalMoves += 1;
testingPath.Add(_vehicle.CurrentHexCell);
var detectionCells = DetectionHead.GetCoveredCells(hexMap.Graph, _vehicle.CurrentHexCell, _vehicle.DetectorRadius, _vehicle.TurnRadius);
//Check Cells for mine
var detection = CheckCells(detectionCells);
//mark as cleared
hexMap.Graph.SetCellsTerrainType(detectionCells, hexMap.ClearedTerrain);
//Handle any detections
if (detection)
{
_reactivePathPlanner.GenerateReactiveHexPath(hexMap, optimalPath, _vehicle.CurrentHexCell);
}
//If the reactive Planner is not empty, empty it before the optimal.
if (_reactivePathPlanner.ReactiveHexPath.TryDequeue(out var next))
_vehicle.CurrentHexCell = next;
//Else we will work off of the optimal path
else
{
//If the optimal path is empty we are done otherwise pop.
if (!optimalPath.TryDequeue(out var nextOptimal))
{
finished = true;
break;
}
var replan = false;
//if the next optimal cell is blocked then we need to replan around it.
while (hexMap.Graph.IsCellBlocked(nextOptimal))
{
replan = true;
if (optimalPath.TryDequeue(out nextOptimal)) continue;
finished = true;
break;
}
if(replan)
{
var tmpPath =
hexMap.Graph.GetShortestPath(_vehicle.CurrentHexCell, nextOptimal, hexMap.DefaultMovement);
if (Math.Abs(_vehicle.CurrentHexCell.X - nextOptimal.X) > 1 || Math.Abs(_vehicle.CurrentHexCell.Y - nextOptimal.Y) > 1)
optimalPath.Dequeue();
tmpPath.AddRange(optimalPath);
optimalPath.Clear();
foreach (var cell in tmpPath)
{
optimalPath.Enqueue(cell);
}
optimalPath.TryDequeue(out nextOptimal);
}
var last = testingPath[testingPath.Count-1];
if (Math.Abs(last.X - nextOptimal.X) > 1 || Math.Abs(last.Y - nextOptimal.Y) > 1)
Console.WriteLine("To big of a gap");
_vehicle.CurrentHexCell = nextOptimal;
}
}
//Debugging information
using(TextWriter tw = new StreamWriter("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/SavedList.txt"))
{
foreach (Coordinate2D s in testingPath)
tw.WriteLine($"{s.X} {s.Y}");
}
using(TextWriter tw = new StreamWriter("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/DetectedMines.txt"))
{
foreach (Coordinate2D s in hexBombsFound)
tw.WriteLine($"{s.X} {s.Y}");
}
var covered = CoveredCells();
Console.WriteLine($"Total cells traversed: {totalMoves} \n" +
$"Minimum required: {minimumMoves}");
Console.WriteLine($"Total bombs found: {hexBombsFound.Count}/{_mineMap.TotalBombs}");
}
private int CoveredCells()
{
var hexMap = _mapFactory.GetHexMap();
//for()
return 0;
}
private bool CheckCells(List<Coordinate2D> detectionCells)
{
var found = false;
foreach (var cell in detectionCells.Where(cell => _mineMap.GetCell(cell.X, cell.Y)))
{
if (!hexBombsFound.Add(cell)) continue;
BlockCells(cell);
found = true;
}
return found;
}
private void BlockCells(Coordinate2D cell)
{
var hexMap = _mapFactory.GetHexMap();
var cellsToBlock = hexMap.Graph.GetRange(cell, _vehicle.Width / 2);
hexMap.Graph.BlockCells(cellsToBlock);
// //debugging
// foreach (var celllll in cellsToBlock)
// {
// Console.WriteLine($"({celllll.X}, {celllll.Y}) Blocked: {hexMap.Graph.GetCellState(celllll).IsBlocked}");
// }
}
private void SquareSimulation()
{

View File

@@ -22,9 +22,9 @@ namespace ConsoleApp
public static void PrintInvalidInput() => Console.WriteLine($"Invalid input try again \n");
public (int width, int height) GetMapDimensions()
public (int width, int height) GetMapDimensions()
{
Console.WriteLine($"Enter map height: ");
Console.WriteLine($"Enter map width: ");
var x = GetUserInput();
if (!int.TryParse(x, out var width))

39
ConsoleApp/plot.py Normal file
View File

@@ -0,0 +1,39 @@
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
if __name__ == "__main__":
xc = []
yc = []
xm = []
ym = []
xf = []
yf = []
with open("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/SavedList.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/DetectedMines.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('test 9')
plt.legend(loc='lower left', fontsize='xx-small')
matplotlib.pyplot.savefig('/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/test.png')
plt.close(fig)