diff --git a/.DS_Store b/.DS_Store
index 6ef9ce9..261ea15 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml b/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml
index 8bae461..6ccea19 100644
--- a/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml
+++ b/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml
@@ -15,6 +15,7 @@
+
@@ -38,10 +39,19 @@
+
+
+
+
+
+
+
+
+
diff --git a/.idea/.idea.RobotIntelFinal/.idea/workspace.xml b/.idea/.idea.RobotIntelFinal/.idea/workspace.xml
index 9ff8581..2fc297b 100644
--- a/.idea/.idea.RobotIntelFinal/.idea/workspace.xml
+++ b/.idea/.idea.RobotIntelFinal/.idea/workspace.xml
@@ -18,21 +18,30 @@
-
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -50,38 +59,10 @@
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -90,16 +71,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -112,39 +106,41 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -156,7 +152,7 @@
-
+
@@ -222,7 +218,9 @@
-
+
+
+
@@ -247,33 +245,10 @@
-
-
-
- file://$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs
- 34
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ConsoleApp/.DS_Store b/ConsoleApp/.DS_Store
new file mode 100644
index 0000000..7ecef30
Binary files /dev/null and b/ConsoleApp/.DS_Store differ
diff --git a/ConsoleApp/HexPlot.py b/ConsoleApp/HexPlot.py
index a10fbe8..9acf4dd 100644
--- a/ConsoleApp/HexPlot.py
+++ b/ConsoleApp/HexPlot.py
@@ -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)
\ No newline at end of file
diff --git a/ConsoleApp/ISimulationResults.cs b/ConsoleApp/ISimulationResults.cs
index e8f930a..23cd46c 100644
--- a/ConsoleApp/ISimulationResults.cs
+++ b/ConsoleApp/ISimulationResults.cs
@@ -15,5 +15,13 @@ namespace ConsoleApp
List Mines { get; set; }
int HexClearedCells { get; set; }
int HexUnClearedCells { get; set; }
+ List SquarePath { get; set; }
+ List SquareMappedBombs { get; set; }
+ int SquareCellsUncleared { get; set; }
+ int SquareCellsCleared { get; set; }
+ int SquareBombsFound { get; set; }
+ int SquareTotalMoves { get; set; }
+ List SquareCoveredCells { get; set; }
+ List HexCoveredCells { get; set; }
}
}
\ No newline at end of file
diff --git a/ConsoleApp/Maps/AstarSquareSearch.cs b/ConsoleApp/Maps/AstarSquareSearch.cs
new file mode 100644
index 0000000..929a7dd
--- /dev/null
+++ b/ConsoleApp/Maps/AstarSquareSearch.cs
@@ -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 FindShortestPath(ISquareMap graph, ICell start, ICell goal)
+ {
+ var costSoFar = new Dictionary();
+ var cameFrom = new Dictionary();
+ var frontier = new PriorityQueue();
+
+ 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();
+ 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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/ConsoleApp/Maps/Cell.cs b/ConsoleApp/Maps/Cell.cs
index ef9bfd4..0acb659 100644
--- a/ConsoleApp/Maps/Cell.cs
+++ b/ConsoleApp/Maps/Cell.cs
@@ -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;
}
diff --git a/ConsoleApp/Maps/ICell.cs b/ConsoleApp/Maps/ICell.cs
index db8db85..b06956f 100644
--- a/ConsoleApp/Maps/ICell.cs
+++ b/ConsoleApp/Maps/ICell.cs
@@ -5,5 +5,6 @@ namespace ConsoleApp.Maps
int X { get; }
int Y { get; }
Coverage Coverage { get; set; }
+ bool Blocked { get; set; }
}
}
\ No newline at end of file
diff --git a/ConsoleApp/Maps/ISquareMap.cs b/ConsoleApp/Maps/ISquareMap.cs
index 3d5e915..8b0a809 100644
--- a/ConsoleApp/Maps/ISquareMap.cs
+++ b/ConsoleApp/Maps/ISquareMap.cs
@@ -12,6 +12,9 @@ namespace ConsoleApp.Maps
Cell GetCell(int x, int y);
int Height { get; }
int Width { get; }
- List GetRange(Cell centerCell, int radius);
+ List GetRange(ICell centerCell, int radius);
+ List GetNeighbors(ICell cell);
+ List GetPassableNeighbors(ICell cell);
+ List GetShortestPath(ICell start, ICell goal);
}
}
\ No newline at end of file
diff --git a/ConsoleApp/Maps/MapExtensions.cs b/ConsoleApp/Maps/MapExtensions.cs
index 4e3e0ab..b67b475 100644
--- a/ConsoleApp/Maps/MapExtensions.cs
+++ b/ConsoleApp/Maps/MapExtensions.cs
@@ -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(this T[,] arr, T value)
diff --git a/ConsoleApp/Maps/SquareMap.cs b/ConsoleApp/Maps/SquareMap.cs
index 2c92e55..f43cf23 100644
--- a/ConsoleApp/Maps/SquareMap.cs
+++ b/ConsoleApp/Maps/SquareMap.cs
@@ -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 GetShortestPath(ICell start, ICell goal)
+ {
+ return AstarSquareSearch.FindShortestPath(this, start, goal);
+ }
- public List GetRange(Cell centerCell, int radius)
+ public List GetRange(ICell centerCell, int radius)
{
var inRange = new List();
var cx = centerCell.X;
@@ -77,6 +88,32 @@ namespace ConsoleApp.Maps
return inRange;
}
+ public List GetPassableNeighbors(ICell cell) =>
+ GetNeighbors(cell).Where(neighbor => !neighbor.Blocked).Cast().ToList();
+
+
+ private static int ComputeHScore(ICell src, Cell dest)
+ {
+ return Math.Abs(dest.X - src.X) + Math.Abs(dest.Y - src.Y);
+ }
+
+
+ public List GetNeighbors(ICell cell)
+ {
+ var rlist = new List();
+ 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];
+ }
}
}
\ No newline at end of file
diff --git a/ConsoleApp/Output/Data.txt b/ConsoleApp/Output/Data.txt
index a3ad04a..c536ecc 100644
--- a/ConsoleApp/Output/Data.txt
+++ b/ConsoleApp/Output/Data.txt
@@ -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
diff --git a/ConsoleApp/Output/HexCoverage.png b/ConsoleApp/Output/HexCoverage.png
new file mode 100644
index 0000000..fb35575
Binary files /dev/null and b/ConsoleApp/Output/HexCoverage.png differ
diff --git a/ConsoleApp/Output/HexCoveredCells.txt b/ConsoleApp/Output/HexCoveredCells.txt
new file mode 100644
index 0000000..2aa75d2
--- /dev/null
+++ b/ConsoleApp/Output/HexCoveredCells.txt
@@ -0,0 +1,2263 @@
+0 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
+1 0
+1 1
+1 2
+1 3
+1 4
+1 5
+1 6
+1 7
+1 8
+1 9
+1 10
+1 11
+1 12
+1 13
+1 14
+1 15
+1 16
+1 17
+1 18
+1 19
+1 20
+1 21
+1 22
+1 23
+1 24
+1 25
+1 26
+1 27
+1 28
+1 29
+1 30
+1 31
+1 32
+1 33
+1 34
+1 35
+1 36
+1 37
+1 38
+1 39
+1 40
+1 41
+1 42
+1 43
+1 44
+1 45
+1 46
+2 0
+2 1
+2 2
+2 3
+2 4
+2 5
+2 6
+2 7
+2 8
+2 9
+2 10
+2 11
+2 12
+2 13
+2 14
+2 15
+2 16
+2 17
+2 18
+2 19
+2 20
+2 21
+2 22
+2 23
+2 24
+2 25
+2 26
+2 27
+2 28
+2 29
+2 30
+2 31
+2 32
+2 33
+2 34
+2 35
+2 36
+2 37
+2 38
+2 39
+2 40
+2 41
+2 42
+2 43
+2 44
+2 45
+2 46
+3 0
+3 1
+3 2
+3 3
+3 4
+3 5
+3 6
+3 7
+3 8
+3 9
+3 10
+3 11
+3 12
+3 13
+3 14
+3 15
+3 16
+3 17
+3 18
+3 19
+3 20
+3 21
+3 22
+3 23
+3 24
+3 25
+3 26
+3 27
+3 28
+3 29
+3 30
+3 31
+3 32
+3 33
+3 34
+3 35
+3 36
+3 37
+3 38
+3 39
+3 40
+3 41
+3 42
+3 43
+3 44
+3 45
+3 46
+4 0
+4 1
+4 2
+4 3
+4 4
+4 5
+4 6
+4 7
+4 8
+4 9
+4 10
+4 11
+4 12
+4 13
+4 14
+4 15
+4 16
+4 17
+4 18
+4 19
+4 20
+4 21
+4 22
+4 23
+4 24
+4 25
+4 26
+4 27
+4 28
+4 29
+4 30
+4 31
+4 32
+4 33
+4 34
+4 35
+4 36
+4 37
+4 38
+4 39
+4 40
+4 41
+4 42
+4 43
+4 44
+4 45
+4 46
+5 0
+5 1
+5 2
+5 3
+5 4
+5 5
+5 6
+5 7
+5 8
+5 9
+5 10
+5 11
+5 12
+5 13
+5 14
+5 15
+5 16
+5 17
+5 18
+5 19
+5 20
+5 21
+5 22
+5 23
+5 24
+5 25
+5 26
+5 27
+5 28
+5 29
+5 30
+5 31
+5 32
+5 33
+5 34
+5 35
+5 36
+5 37
+5 38
+5 39
+5 40
+5 41
+5 42
+5 43
+5 44
+5 45
+5 46
+6 0
+6 1
+6 2
+6 3
+6 4
+6 5
+6 6
+6 7
+6 8
+6 9
+6 10
+6 11
+6 12
+6 13
+6 14
+6 15
+6 16
+6 17
+6 18
+6 19
+6 20
+6 21
+6 22
+6 23
+6 24
+6 25
+6 26
+6 27
+6 28
+6 29
+6 30
+6 31
+6 32
+6 33
+6 34
+6 35
+6 36
+6 37
+6 38
+6 39
+6 40
+6 41
+6 42
+6 43
+6 44
+6 45
+6 46
+7 0
+7 1
+7 2
+7 3
+7 4
+7 5
+7 6
+7 7
+7 8
+7 9
+7 10
+7 11
+7 12
+7 13
+7 14
+7 15
+7 16
+7 17
+7 18
+7 19
+7 20
+7 21
+7 22
+7 23
+7 24
+7 25
+7 26
+7 27
+7 28
+7 29
+7 30
+7 31
+7 32
+7 33
+7 34
+7 35
+7 36
+7 37
+7 38
+7 39
+7 40
+7 41
+7 42
+7 43
+7 44
+7 45
+7 46
+8 0
+8 1
+8 2
+8 3
+8 4
+8 5
+8 6
+8 7
+8 8
+8 9
+8 10
+8 11
+8 12
+8 13
+8 14
+8 15
+8 16
+8 17
+8 18
+8 19
+8 20
+8 21
+8 22
+8 23
+8 24
+8 25
+8 26
+8 27
+8 28
+8 29
+8 30
+8 31
+8 32
+8 33
+8 34
+8 35
+8 36
+8 37
+8 38
+8 39
+8 40
+8 41
+8 42
+8 43
+8 44
+8 45
+8 46
+9 0
+9 1
+9 2
+9 3
+9 4
+9 5
+9 6
+9 7
+9 8
+9 9
+9 10
+9 11
+9 12
+9 13
+9 14
+9 15
+9 16
+9 17
+9 18
+9 19
+9 20
+9 21
+9 22
+9 23
+9 24
+9 25
+9 26
+9 27
+9 28
+9 29
+9 30
+9 31
+9 32
+9 33
+9 34
+9 35
+9 36
+9 37
+9 38
+9 39
+9 40
+9 41
+9 42
+9 43
+9 44
+9 45
+9 46
+10 0
+10 1
+10 2
+10 3
+10 4
+10 5
+10 6
+10 7
+10 8
+10 9
+10 10
+10 11
+10 12
+10 13
+10 14
+10 15
+10 16
+10 17
+10 18
+10 19
+10 20
+10 21
+10 22
+10 23
+10 24
+10 25
+10 26
+10 27
+10 28
+10 29
+10 30
+10 31
+10 32
+10 33
+10 34
+10 35
+10 36
+10 37
+10 38
+10 39
+10 40
+10 41
+10 42
+10 43
+10 44
+10 45
+10 46
+11 0
+11 1
+11 2
+11 3
+11 4
+11 5
+11 6
+11 7
+11 8
+11 9
+11 10
+11 11
+11 12
+11 13
+11 14
+11 15
+11 16
+11 17
+11 18
+11 19
+11 20
+11 21
+11 22
+11 23
+11 24
+11 25
+11 26
+11 27
+11 28
+11 29
+11 30
+11 31
+11 32
+11 33
+11 34
+11 35
+11 36
+11 37
+11 38
+11 39
+11 40
+11 41
+11 42
+11 43
+11 44
+11 45
+11 46
+12 0
+12 1
+12 2
+12 3
+12 4
+12 5
+12 6
+12 7
+12 8
+12 9
+12 10
+12 11
+12 12
+12 13
+12 14
+12 15
+12 16
+12 17
+12 18
+12 19
+12 20
+12 21
+12 22
+12 23
+12 24
+12 25
+12 26
+12 27
+12 28
+12 29
+12 30
+12 31
+12 32
+12 33
+12 34
+12 35
+12 36
+12 37
+12 38
+12 39
+12 40
+12 41
+12 42
+12 43
+12 44
+12 45
+12 46
+13 0
+13 1
+13 2
+13 3
+13 4
+13 5
+13 6
+13 7
+13 8
+13 9
+13 10
+13 11
+13 12
+13 13
+13 14
+13 15
+13 16
+13 17
+13 18
+13 19
+13 20
+13 21
+13 22
+13 23
+13 24
+13 25
+13 26
+13 27
+13 28
+13 29
+13 30
+13 31
+13 32
+13 33
+13 34
+13 35
+13 36
+13 37
+13 38
+13 39
+13 40
+13 41
+13 42
+13 43
+13 44
+13 45
+13 46
+14 0
+14 1
+14 2
+14 3
+14 4
+14 5
+14 6
+14 7
+14 8
+14 9
+14 10
+14 11
+14 12
+14 13
+14 14
+14 15
+14 16
+14 17
+14 18
+14 19
+14 20
+14 21
+14 22
+14 23
+14 24
+14 25
+14 26
+14 27
+14 28
+14 29
+14 30
+14 31
+14 32
+14 33
+14 34
+14 35
+14 36
+14 37
+14 38
+14 39
+14 40
+14 41
+14 42
+14 43
+14 44
+14 45
+14 46
+15 0
+15 1
+15 2
+15 3
+15 4
+15 5
+15 6
+15 7
+15 8
+15 9
+15 10
+15 11
+15 12
+15 13
+15 14
+15 15
+15 16
+15 17
+15 18
+15 19
+15 20
+15 21
+15 22
+15 23
+15 24
+15 25
+15 26
+15 27
+15 28
+15 29
+15 30
+15 31
+15 32
+15 33
+15 34
+15 35
+15 36
+15 37
+15 38
+15 39
+15 40
+15 41
+15 42
+15 43
+15 44
+15 45
+15 46
+15 47
+16 0
+16 1
+16 2
+16 3
+16 4
+16 5
+16 6
+16 7
+16 8
+16 9
+16 10
+16 11
+16 12
+16 13
+16 14
+16 15
+16 16
+16 17
+16 18
+16 19
+16 20
+16 21
+16 22
+16 23
+16 24
+16 25
+16 26
+16 27
+16 28
+16 29
+16 30
+16 31
+16 32
+16 33
+16 34
+16 35
+16 36
+16 37
+16 38
+16 39
+16 40
+16 41
+16 42
+16 43
+16 44
+16 45
+16 46
+16 47
+17 0
+17 1
+17 2
+17 3
+17 4
+17 5
+17 6
+17 7
+17 8
+17 9
+17 10
+17 11
+17 12
+17 13
+17 14
+17 15
+17 16
+17 17
+17 18
+17 20
+17 21
+17 22
+17 23
+17 24
+17 25
+17 26
+17 27
+17 28
+17 29
+17 30
+17 31
+17 32
+17 33
+17 34
+17 35
+17 36
+17 37
+17 38
+17 39
+17 40
+17 41
+17 42
+17 43
+17 44
+17 45
+17 46
+17 47
+18 0
+18 1
+18 2
+18 3
+18 4
+18 5
+18 6
+18 7
+18 8
+18 9
+18 10
+18 11
+18 12
+18 13
+18 14
+18 15
+18 16
+18 17
+18 18
+18 20
+18 21
+18 22
+18 23
+18 24
+18 25
+18 26
+18 27
+18 28
+18 29
+18 30
+18 31
+18 32
+18 33
+18 34
+18 35
+18 36
+18 37
+18 38
+18 39
+18 40
+18 41
+18 42
+18 43
+18 44
+18 45
+18 46
+18 47
+19 0
+19 1
+19 2
+19 3
+19 4
+19 5
+19 6
+19 7
+19 8
+19 9
+19 10
+19 11
+19 12
+19 13
+19 14
+19 15
+19 16
+19 17
+19 18
+19 20
+19 21
+19 22
+19 23
+19 24
+19 25
+19 26
+19 27
+19 28
+19 29
+19 30
+19 31
+19 32
+19 33
+19 34
+19 35
+19 36
+19 37
+19 38
+19 39
+19 40
+19 41
+19 42
+19 43
+19 44
+19 45
+19 46
+19 47
+20 0
+20 1
+20 2
+20 3
+20 4
+20 5
+20 6
+20 7
+20 8
+20 9
+20 10
+20 11
+20 12
+20 13
+20 14
+20 15
+20 16
+20 17
+20 18
+20 19
+20 20
+20 21
+20 22
+20 23
+20 24
+20 25
+20 26
+20 27
+20 28
+20 29
+20 30
+20 31
+20 32
+20 33
+20 34
+20 35
+20 36
+20 37
+20 38
+20 39
+20 40
+20 41
+20 42
+20 43
+20 44
+20 45
+20 46
+20 47
+21 0
+21 1
+21 2
+21 3
+21 4
+21 5
+21 6
+21 7
+21 8
+21 9
+21 10
+21 11
+21 12
+21 13
+21 14
+21 15
+21 16
+21 17
+21 18
+21 19
+21 20
+21 21
+21 22
+21 23
+21 24
+21 25
+21 26
+21 27
+21 28
+21 29
+21 30
+21 31
+21 32
+21 33
+21 34
+21 35
+21 36
+21 37
+21 38
+21 39
+21 40
+21 41
+21 42
+21 43
+21 44
+21 45
+21 46
+21 47
+22 0
+22 1
+22 2
+22 3
+22 4
+22 5
+22 6
+22 7
+22 8
+22 9
+22 10
+22 11
+22 12
+22 13
+22 14
+22 15
+22 16
+22 17
+22 18
+22 19
+22 20
+22 21
+22 22
+22 23
+22 24
+22 25
+22 26
+22 27
+22 28
+22 29
+22 30
+22 31
+22 32
+22 33
+22 34
+22 35
+22 36
+22 37
+22 38
+22 39
+22 40
+22 41
+22 42
+22 43
+22 44
+22 45
+22 46
+22 47
+23 0
+23 1
+23 2
+23 3
+23 4
+23 5
+23 6
+23 7
+23 8
+23 9
+23 10
+23 11
+23 12
+23 13
+23 14
+23 15
+23 16
+23 17
+23 18
+23 19
+23 20
+23 21
+23 22
+23 23
+23 24
+23 25
+23 26
+23 27
+23 28
+23 29
+23 30
+23 31
+23 32
+23 33
+23 34
+23 35
+23 36
+23 37
+23 38
+23 39
+23 40
+23 41
+23 42
+23 43
+23 44
+23 45
+23 46
+23 47
+24 0
+24 1
+24 2
+24 3
+24 4
+24 5
+24 6
+24 7
+24 8
+24 9
+24 10
+24 11
+24 12
+24 13
+24 14
+24 15
+24 16
+24 17
+24 18
+24 19
+24 20
+24 21
+24 22
+24 23
+24 24
+24 25
+24 26
+24 27
+24 28
+24 29
+24 30
+24 31
+24 32
+24 33
+24 34
+24 35
+24 36
+24 37
+24 38
+24 39
+24 40
+24 41
+24 42
+24 43
+24 44
+24 45
+24 46
+24 47
+25 0
+25 1
+25 2
+25 3
+25 4
+25 5
+25 6
+25 7
+25 8
+25 9
+25 10
+25 11
+25 12
+25 13
+25 14
+25 15
+25 16
+25 17
+25 18
+25 19
+25 20
+25 21
+25 22
+25 23
+25 24
+25 25
+25 26
+25 27
+25 28
+25 29
+25 30
+25 31
+25 32
+25 33
+25 34
+25 35
+25 36
+25 37
+25 38
+25 39
+25 40
+25 41
+25 42
+25 43
+25 44
+25 45
+25 46
+26 0
+26 1
+26 2
+26 3
+26 4
+26 5
+26 6
+26 7
+26 8
+26 9
+26 10
+26 11
+26 12
+26 13
+26 14
+26 15
+26 16
+26 17
+26 18
+26 19
+26 20
+26 21
+26 22
+26 23
+26 24
+26 25
+26 26
+26 27
+26 28
+26 29
+26 30
+26 31
+26 32
+26 33
+26 34
+26 35
+26 36
+26 37
+26 38
+26 39
+26 40
+26 41
+26 42
+26 43
+26 44
+26 45
+26 46
+27 0
+27 1
+27 2
+27 3
+27 4
+27 5
+27 6
+27 7
+27 8
+27 9
+27 10
+27 11
+27 12
+27 13
+27 14
+27 15
+27 16
+27 17
+27 18
+27 19
+27 20
+27 21
+27 22
+27 23
+27 24
+27 25
+27 26
+27 27
+27 28
+27 29
+27 30
+27 31
+27 32
+27 33
+27 34
+27 35
+27 36
+27 37
+27 38
+27 39
+27 40
+27 41
+27 42
+27 43
+27 44
+27 45
+27 46
+28 0
+28 1
+28 2
+28 3
+28 4
+28 5
+28 6
+28 7
+28 8
+28 9
+28 10
+28 11
+28 12
+28 13
+28 14
+28 15
+28 16
+28 17
+28 18
+28 19
+28 20
+28 21
+28 22
+28 23
+28 24
+28 25
+28 26
+28 27
+28 28
+28 29
+28 30
+28 31
+28 32
+28 33
+28 34
+28 35
+28 36
+28 37
+28 38
+28 39
+28 40
+28 41
+28 42
+28 43
+28 44
+28 45
+28 46
+29 0
+29 1
+29 2
+29 3
+29 4
+29 5
+29 6
+29 7
+29 8
+29 9
+29 10
+29 11
+29 12
+29 13
+29 14
+29 15
+29 16
+29 17
+29 18
+29 19
+29 20
+29 21
+29 22
+29 23
+29 24
+29 25
+29 26
+29 27
+29 28
+29 29
+29 30
+29 31
+29 32
+29 33
+29 34
+29 35
+29 36
+29 37
+29 38
+29 39
+29 40
+29 41
+29 42
+29 43
+29 44
+29 45
+29 46
+30 0
+30 1
+30 2
+30 3
+30 4
+30 5
+30 6
+30 7
+30 8
+30 9
+30 10
+30 11
+30 12
+30 13
+30 14
+30 15
+30 16
+30 17
+30 18
+30 19
+30 20
+30 21
+30 22
+30 23
+30 24
+30 25
+30 26
+30 27
+30 28
+30 29
+30 30
+30 31
+30 32
+30 33
+30 34
+30 35
+30 36
+30 37
+30 38
+30 39
+30 40
+30 41
+30 42
+30 43
+30 44
+30 45
+30 46
+31 0
+31 1
+31 2
+31 3
+31 4
+31 5
+31 6
+31 7
+31 8
+31 9
+31 10
+31 11
+31 12
+31 13
+31 14
+31 15
+31 16
+31 17
+31 18
+31 19
+31 20
+31 21
+31 22
+31 23
+31 24
+31 25
+31 26
+31 27
+31 28
+31 29
+31 30
+31 31
+31 32
+31 33
+31 34
+31 35
+31 36
+31 37
+31 38
+31 39
+31 40
+31 41
+31 42
+31 43
+31 44
+31 45
+31 46
+32 0
+32 1
+32 2
+32 3
+32 4
+32 5
+32 6
+32 7
+32 8
+32 9
+32 10
+32 11
+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
+33 0
+33 1
+33 2
+33 3
+33 4
+33 5
+33 6
+33 7
+33 8
+33 9
+33 10
+33 11
+33 12
+33 13
+33 14
+33 15
+33 16
+33 17
+33 18
+33 19
+33 20
+33 21
+33 22
+33 23
+33 24
+33 25
+33 26
+33 27
+33 28
+33 29
+33 30
+33 31
+33 32
+33 33
+33 34
+33 35
+33 36
+33 37
+33 38
+33 39
+33 40
+33 41
+33 42
+33 43
+33 44
+33 45
+33 46
+34 0
+34 1
+34 2
+34 3
+34 4
+34 5
+34 6
+34 7
+34 8
+34 9
+34 10
+34 11
+34 12
+34 13
+34 14
+34 15
+34 16
+34 17
+34 18
+34 19
+34 20
+34 21
+34 22
+34 23
+34 24
+34 25
+34 26
+34 27
+34 28
+34 29
+34 30
+34 31
+34 32
+34 33
+34 34
+34 35
+34 36
+34 37
+34 38
+34 39
+34 40
+34 41
+34 42
+34 43
+34 44
+34 45
+34 46
+35 0
+35 1
+35 2
+35 3
+35 4
+35 5
+35 6
+35 7
+35 8
+35 9
+35 10
+35 11
+35 12
+35 13
+35 14
+35 15
+35 16
+35 17
+35 18
+35 19
+35 20
+35 21
+35 22
+35 23
+35 24
+35 25
+35 26
+35 27
+35 28
+35 29
+35 30
+35 31
+35 32
+35 33
+35 34
+35 35
+35 36
+35 37
+35 38
+35 39
+35 40
+35 41
+35 42
+35 43
+35 44
+35 45
+35 46
+36 0
+36 1
+36 2
+36 3
+36 4
+36 5
+36 6
+36 7
+36 8
+36 9
+36 10
+36 11
+36 12
+36 13
+36 14
+36 15
+36 16
+36 17
+36 18
+36 19
+36 20
+36 21
+36 22
+36 23
+36 24
+36 25
+36 26
+36 27
+36 28
+36 29
+36 30
+36 31
+36 32
+36 33
+36 34
+36 35
+36 36
+36 37
+36 38
+36 39
+36 40
+36 41
+36 42
+36 43
+36 44
+36 45
+36 46
+37 0
+37 1
+37 2
+37 3
+37 4
+37 5
+37 6
+37 7
+37 8
+37 9
+37 10
+37 11
+37 12
+37 13
+37 14
+37 15
+37 16
+37 17
+37 18
+37 19
+37 20
+37 21
+37 22
+37 23
+37 24
+37 25
+37 26
+37 27
+37 28
+37 29
+37 30
+37 31
+37 32
+37 33
+37 34
+37 35
+37 36
+37 37
+37 38
+37 39
+37 40
+37 41
+37 42
+37 43
+37 44
+37 45
+37 46
+38 0
+38 1
+38 2
+38 3
+38 4
+38 5
+38 6
+38 7
+38 8
+38 9
+38 10
+38 11
+38 12
+38 13
+38 14
+38 15
+38 16
+38 17
+38 18
+38 19
+38 20
+38 21
+38 22
+38 23
+38 24
+38 25
+38 26
+38 27
+38 28
+38 29
+38 30
+38 31
+38 32
+38 33
+38 34
+38 35
+38 36
+38 37
+38 38
+38 39
+38 40
+38 41
+38 42
+38 43
+38 44
+38 45
+38 46
+39 0
+39 1
+39 2
+39 3
+39 4
+39 5
+39 6
+39 7
+39 8
+39 9
+39 10
+39 11
+39 12
+39 13
+39 14
+39 15
+39 16
+39 17
+39 18
+39 19
+39 20
+39 21
+39 22
+39 23
+39 24
+39 25
+39 26
+39 27
+39 28
+39 29
+39 30
+39 31
+39 32
+39 33
+39 34
+39 35
+39 36
+39 37
+39 38
+39 39
+39 40
+39 41
+39 42
+39 43
+39 44
+39 45
+39 46
+40 0
+40 1
+40 2
+40 3
+40 4
+40 5
+40 6
+40 7
+40 8
+40 9
+40 10
+40 11
+40 12
+40 13
+40 14
+40 15
+40 16
+40 17
+40 18
+40 19
+40 20
+40 21
+40 22
+40 23
+40 24
+40 25
+40 26
+40 27
+40 28
+40 29
+40 30
+40 31
+40 32
+40 33
+40 34
+40 35
+40 36
+40 37
+40 38
+40 39
+40 40
+40 41
+40 42
+40 43
+40 44
+40 45
+40 46
+41 0
+41 1
+41 2
+41 3
+41 4
+41 5
+41 6
+41 7
+41 8
+41 9
+41 10
+41 11
+41 12
+41 13
+41 14
+41 15
+41 16
+41 17
+41 18
+41 19
+41 20
+41 21
+41 22
+41 23
+41 24
+41 25
+41 26
+41 27
+41 28
+41 29
+41 30
+41 31
+41 32
+41 33
+41 34
+41 35
+41 36
+41 37
+41 38
+41 39
+41 40
+41 41
+41 42
+41 43
+41 44
+41 45
+41 46
+42 0
+42 1
+42 2
+42 3
+42 4
+42 5
+42 6
+42 7
+42 8
+42 9
+42 10
+42 11
+42 12
+42 13
+42 14
+42 15
+42 16
+42 17
+42 18
+42 19
+42 20
+42 21
+42 22
+42 23
+42 24
+42 25
+42 26
+42 27
+42 28
+42 29
+42 30
+42 31
+42 32
+42 33
+42 34
+42 35
+42 36
+42 37
+42 38
+42 39
+42 40
+42 41
+42 42
+42 43
+42 44
+42 45
+42 46
+43 0
+43 1
+43 2
+43 3
+43 4
+43 5
+43 6
+43 7
+43 8
+43 9
+43 10
+43 11
+43 12
+43 13
+43 14
+43 15
+43 16
+43 17
+43 18
+43 19
+43 20
+43 21
+43 22
+43 23
+43 24
+43 25
+43 26
+43 27
+43 28
+43 29
+43 30
+43 31
+43 32
+43 33
+43 34
+43 35
+43 36
+43 37
+43 38
+43 39
+43 40
+43 41
+43 42
+43 43
+43 44
+43 45
+43 46
+44 0
+44 1
+44 2
+44 3
+44 4
+44 5
+44 6
+44 7
+44 8
+44 9
+44 10
+44 11
+44 12
+44 13
+44 14
+44 15
+44 16
+44 17
+44 18
+44 19
+44 20
+44 21
+44 22
+44 23
+44 24
+44 25
+44 26
+44 27
+44 28
+44 29
+44 30
+44 31
+44 32
+44 33
+44 34
+44 35
+44 36
+44 37
+44 38
+44 39
+44 40
+44 41
+44 42
+44 43
+44 44
+44 45
+44 46
+45 0
+45 1
+45 2
+45 3
+45 4
+45 5
+45 6
+45 7
+45 8
+45 9
+45 10
+45 11
+45 12
+45 13
+45 14
+45 15
+45 16
+45 17
+45 18
+45 19
+45 20
+45 21
+45 22
+45 23
+45 24
+45 25
+45 26
+45 27
+45 28
+45 29
+45 30
+45 31
+45 32
+45 33
+45 34
+45 35
+45 36
+45 37
+45 38
+45 39
+45 40
+45 41
+45 42
+45 43
+45 44
+45 45
+45 46
+46 0
+46 1
+46 2
+46 3
+46 4
+46 5
+46 6
+46 7
+46 8
+46 9
+46 10
+46 11
+46 12
+46 13
+46 14
+46 15
+46 16
+46 17
+46 18
+46 19
+46 20
+46 21
+46 22
+46 23
+46 24
+46 25
+46 26
+46 27
+46 28
+46 29
+46 30
+46 31
+46 32
+46 33
+46 34
+46 35
+46 36
+46 37
+46 38
+46 39
+46 40
+46 41
+46 42
+46 43
+46 44
+46 45
+46 46
+47 0
+47 1
+47 2
+47 3
+47 4
+47 5
+47 6
+47 7
+47 8
+47 9
+47 10
+47 11
+47 12
+47 13
+47 14
+47 15
+47 16
+47 17
+47 18
+47 19
+47 20
+47 21
+47 22
+47 23
+47 24
+47 25
+47 26
+47 27
+47 28
+47 29
+47 30
+47 31
+47 32
+47 33
+47 34
+47 35
+47 36
+47 37
+47 38
+47 39
+47 40
+47 41
+47 42
+47 43
+47 44
+47 45
+47 46
diff --git a/ConsoleApp/Output/HexDetectedMines.txt b/ConsoleApp/Output/HexDetectedMines.txt
index e69de29..7730921 100644
--- a/ConsoleApp/Output/HexDetectedMines.txt
+++ b/ConsoleApp/Output/HexDetectedMines.txt
@@ -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
diff --git a/ConsoleApp/Output/HexPath.txt b/ConsoleApp/Output/HexPath.txt
index 032288e..107d209 100644
--- a/ConsoleApp/Output/HexPath.txt
+++ b/ConsoleApp/Output/HexPath.txt
@@ -49,374 +49,134 @@
47 1
47 2
47 3
-46 3
-45 3
-44 3
-43 3
-42 3
-41 3
-40 3
-39 3
-38 3
-37 3
-36 3
-35 3
-34 3
-33 3
-32 3
-31 3
-30 3
-29 3
-28 3
-27 3
-26 3
-25 3
-24 3
-23 3
-22 3
-21 3
-20 3
-19 3
-18 3
-17 3
-16 3
-15 3
-14 3
-13 3
-12 3
-11 3
-10 3
-9 3
-8 3
-7 3
-6 3
-5 3
-4 3
-3 3
-2 3
-1 3
-0 3
-1 4
-0 5
-0 6
-1 6
-2 6
-3 6
-4 6
-5 6
-6 6
-7 6
-6 5
-7 4
-8 4
-9 4
-10 4
-10 5
-11 6
-12 6
-13 6
-14 6
-15 6
-16 6
-17 6
-18 6
-19 6
-20 6
-21 6
-20 5
-21 4
-22 4
-23 4
-24 4
-24 5
-25 6
-26 6
-27 6
-28 6
-29 6
-30 6
-31 6
-32 6
-33 6
-34 6
-35 6
-36 6
-37 6
-38 6
-39 6
-40 6
-41 6
-42 6
-43 6
-44 6
-45 6
-46 6
+47 4
+47 5
47 6
47 7
-47 8
-47 9
-46 9
-45 9
-44 9
-43 9
-42 9
+46 7
+45 7
+44 7
+43 7
+42 7
+42 7
+42 7
+42 8
41 9
-40 9
-39 9
-38 9
+41 10
+40 10
+39 10
+38 10
37 9
-36 9
-35 9
-34 9
-33 9
-32 9
-31 9
-30 9
-29 9
-28 9
-27 9
-27 8
-26 8
-25 8
-24 9
-24 9
-24 10
-23 10
-23 11
-23 12
-22 12
-21 12
-20 12
-19 11
-19 10
-18 9
-17 9
-16 9
-15 9
-14 9
-13 9
-12 9
-12 9
-13 10
-12 11
-12 12
-13 12
-13 13
-13 14
-12 15
-12 16
-11 16
-10 16
-9 16
-8 15
-8 14
-7 13
-7 12
-6 11
-6 10
-5 9
-4 9
-3 9
-2 9
+37 8
+36 7
+35 7
+34 7
+33 7
+32 7
+31 7
+30 7
+29 7
+28 7
+27 7
+26 7
+25 7
+24 7
+23 7
+22 7
+21 7
+20 7
+19 7
+19 7
+19 6
+18 5
+17 5
+16 5
+15 5
+15 6
+14 7
+13 7
+12 7
+11 7
+10 7
+9 7
+8 7
+7 7
+6 7
+5 7
+4 7
+3 7
+2 7
+1 7
+0 7
+1 8
1 9
-0 9
-1 10
-0 11
-0 12
+2 10
+1 11
1 12
-2 12
-3 12
-4 12
-5 12
-6 12
-7 12
-8 12
-8 12
-7 13
+0 13
+0 14
+1 14
+2 14
+3 14
+4 14
+5 14
+6 14
+7 14
8 14
-8 15
-9 16
+9 14
+9 14
+9 14
+9 15
10 16
-11 16
-12 16
-12 15
-13 14
-13 13
-13 12
-14 12
-15 12
-16 12
-17 12
-18 12
-19 12
-20 12
-21 12
-22 12
-22 12
-21 13
-21 14
-20 13
-19 13
+10 17
+11 17
+12 17
+13 17
+14 16
+14 15
+15 14
+16 14
+17 14
+18 14
19 14
-18 15
-18 16
-18 17
-19 18
-19 19
-20 19
-21 19
-22 19
-23 18
-23 17
-23 18
-23 19
-24 19
-25 19
-26 19
-27 18
+20 14
+21 14
+22 14
+23 14
+24 14
+24 14
+24 14
+24 15
+25 16
+25 17
+26 17
27 17
-28 16
-28 15
-29 14
-29 13
-30 12
-31 12
-32 12
-33 12
-34 12
-35 12
-36 12
-37 12
-38 12
-39 12
-40 12
-41 12
-42 12
-43 12
-44 12
-45 12
-46 12
-47 12
-47 13
+28 17
+29 16
+29 16
+30 16
+30 17
+31 17
+32 17
+33 17
+34 16
+34 15
+35 14
+36 14
+37 14
+38 14
+39 14
+40 14
+41 14
+42 14
+43 14
+44 14
+45 14
+46 14
47 14
47 15
-46 15
-45 15
-44 15
-43 15
-42 15
-41 15
-41 14
-40 14
-39 14
-38 15
-37 15
-36 15
-35 15
-34 15
-33 15
-32 15
-31 15
-30 15
-29 15
-28 15
-27 15
-27 15
-28 16
-27 17
-27 18
-26 19
-25 19
-24 19
-23 19
-22 19
-21 19
-20 19
-19 19
-19 18
-18 17
-18 16
-18 15
-17 15
-16 15
-15 15
-14 15
-13 15
-12 15
-12 15
-12 16
-11 16
-10 16
-9 16
-8 15
-7 15
-6 15
-5 15
-4 15
-3 15
-2 15
-1 15
-0 15
-1 16
-0 17
-0 18
-1 18
-2 18
-3 18
-4 18
-5 18
-6 18
-5 17
-6 16
-7 16
-8 16
-9 16
-9 17
-10 16
-11 16
-12 16
-12 17
-13 18
-14 18
-15 18
-16 18
-17 18
-18 18
-19 18
-19 18
-19 19
-20 19
-21 19
-22 19
-23 18
-23 18
-23 19
-24 19
-25 19
-26 19
-27 18
-28 18
-29 18
-30 18
-31 18
-32 18
-33 18
-34 18
-35 18
-36 18
-37 18
-38 18
-38 18
-38 19
-39 20
-40 20
-41 20
-42 20
-42 19
-43 18
-44 18
-45 18
-46 18
+47 16
+47 17
47 18
47 19
47 20
@@ -432,39 +192,49 @@
38 21
37 21
36 21
-36 20
+35 21
+35 21
35 20
-34 20
-33 21
-32 21
-31 21
-30 21
-29 21
+34 19
+33 19
+33 18
+32 17
+31 17
+30 17
+29 17
+29 18
+28 19
+28 20
28 21
27 21
26 21
25 21
24 21
23 21
-22 21
-21 21
-20 21
-19 21
-18 21
-17 21
-16 21
-15 21
-14 21
-13 21
-12 21
-12 21
+23 21
+23 22
+22 23
+22 24
+21 24
+20 24
+19 24
+18 24
+17 25
+17 26
+16 26
+15 26
+14 26
+13 25
+13 24
+12 23
12 22
-11 22
-10 22
-9 22
-8 22
-7 22
-6 22
+12 21
+11 21
+10 21
+9 21
+8 21
+7 21
+6 21
5 21
4 21
3 21
@@ -472,359 +242,127 @@
1 21
0 21
1 22
-0 23
-0 24
-1 24
+1 23
2 24
-3 24
-4 24
-5 24
-6 24
-7 24
-6 23
-7 22
-8 22
-9 22
-10 22
-10 23
-11 24
-12 24
-13 24
-14 24
-15 24
-16 24
-17 24
-18 24
-19 24
-20 24
-21 24
-22 24
-23 24
-24 24
-25 24
-26 24
-27 24
-28 24
-29 24
-30 24
-31 24
-32 24
-31 24
-30 25
-30 26
-30 27
-31 28
-31 29
-32 29
-33 29
-34 29
-35 28
-35 27
-36 26
-37 26
-37 25
-38 24
-39 24
-40 24
-41 24
-42 24
-43 24
-44 24
-45 24
-46 24
-47 24
-47 25
-47 26
-47 27
-46 27
-45 27
-44 27
-43 27
-42 27
-41 27
-40 27
-39 27
-38 27
-37 27
-36 27
-35 27
-35 27
-35 28
-34 29
-33 29
-32 29
-31 29
-31 28
-30 27
-29 27
-28 27
-27 27
-26 27
-25 27
-24 27
-23 27
-22 27
-21 27
-20 27
-19 27
-18 27
-17 27
-16 27
-15 27
-14 27
-13 27
-12 27
-11 27
-12 27
-13 28
-12 29
-12 30
-11 31
-10 31
-9 31
-8 31
-8 30
-7 29
-7 28
-6 27
-5 27
-4 27
-3 27
-2 27
-1 27
+1 25
+1 26
0 27
+0 28
1 28
-0 29
-0 30
-1 30
-2 30
-3 30
-4 30
-5 30
-5 29
-6 29
-7 29
-8 30
-8 30
-8 31
-9 31
-10 31
-11 31
-12 30
-13 30
-14 30
-15 30
-16 30
-17 30
-18 30
-18 30
-17 31
-18 32
-18 33
-19 33
-20 33
-21 33
-22 32
-22 31
-23 30
-24 30
-25 30
-26 30
-27 30
-28 30
-29 30
-30 30
-31 30
-32 30
-33 30
-34 30
-35 30
-36 30
-37 30
-38 30
-39 30
-40 30
-41 30
-42 30
-43 30
-44 30
-45 30
-46 30
+2 28
+3 28
+4 28
+5 28
+6 28
+7 28
+7 28
+7 27
+8 26
+9 26
+10 26
+11 26
+11 27
+12 28
+13 28
+14 28
+15 28
+16 28
+17 28
+18 28
+19 28
+20 28
+21 28
+22 28
+23 28
+24 28
+25 28
+26 28
+27 28
+28 28
+29 28
+30 28
+31 28
+32 28
+32 28
+32 29
+33 29
+34 29
+35 29
+36 29
+37 29
+38 29
+39 28
+40 28
+41 28
+42 28
+43 28
+44 28
+45 28
+46 28
+47 28
+47 29
47 30
47 31
47 32
47 33
-46 33
-45 33
-44 33
-43 33
-42 33
-41 33
-40 33
-39 33
-40 32
-39 31
-38 31
-37 31
-36 31
-36 32
+47 34
+47 35
+46 35
+45 35
+44 35
+43 35
+42 35
+41 35
+40 35
+39 35
+38 35
+37 35
+37 34
+36 33
35 33
34 33
33 33
32 33
-31 33
-30 33
-29 33
-28 33
-27 33
-26 33
-25 33
-24 33
-23 33
-22 33
-21 33
-20 33
-19 33
-18 33
-17 33
-16 33
-15 33
-14 33
-13 33
-12 33
+32 34
+31 35
+30 35
+29 35
+28 35
+27 35
+26 35
+25 35
+24 35
+23 35
+22 35
+21 35
+20 35
+19 35
+18 35
+17 35
+16 35
+15 35
+14 35
+13 35
+12 35
+12 35
+12 34
11 33
10 33
9 33
8 33
-8 33
8 34
7 35
6 35
5 35
4 35
-4 34
-3 33
-2 33
-1 33
-0 33
-1 34
+3 35
+2 35
+1 35
0 35
-0 36
1 36
-2 36
-3 36
-4 36
-5 36
-6 36
-7 36
-8 36
-9 36
-10 36
-11 36
-12 36
-13 36
-14 36
-15 36
-16 36
-17 36
-18 36
-18 35
-19 35
-19 34
-19 33
-20 33
-21 33
-22 33
-23 34
-23 35
-24 36
-25 36
-26 36
-27 36
-28 36
-29 36
-29 35
-30 35
-31 35
-32 36
-33 36
-34 36
-35 36
-36 36
-36 36
-36 37
-37 37
-38 37
-39 37
-40 36
-41 36
-42 36
-43 36
-44 36
-45 36
-46 36
-47 36
-47 37
-47 38
-47 39
-46 39
-45 39
-44 39
-43 39
-42 39
-41 39
-40 39
-39 39
-38 39
-38 39
-38 39
-38 40
-37 41
-37 42
-36 42
-35 42
-34 42
-33 41
-33 40
-32 39
-32 39
-32 40
-31 41
-30 41
-29 41
-28 41
-28 40
-27 39
-26 39
-25 39
-24 39
-23 39
-22 39
-21 39
-21 39
-21 40
-20 41
-19 41
-18 41
-17 41
-17 40
-16 39
-15 39
-14 39
-13 39
-12 39
-11 39
-10 39
-9 39
-8 39
-7 39
-6 39
-5 39
-4 39
-3 39
-2 39
+1 37
+2 38
1 39
-0 39
1 40
0 41
0 42
@@ -845,11 +383,16 @@
15 42
16 42
17 42
-18 42
-19 42
-20 42
-21 42
-22 42
+17 42
+17 42
+17 43
+18 44
+18 45
+19 45
+20 45
+21 45
+22 44
+22 43
23 42
24 42
25 42
@@ -875,53 +418,3 @@
45 42
46 42
47 42
-47 43
-47 44
-47 45
-46 45
-45 45
-44 45
-43 45
-42 45
-41 45
-40 45
-39 45
-38 45
-37 45
-36 45
-35 45
-34 45
-33 45
-32 45
-31 45
-30 45
-29 45
-28 45
-27 45
-26 45
-25 45
-24 45
-23 45
-22 45
-21 45
-20 45
-19 45
-18 45
-17 45
-16 45
-15 45
-14 45
-13 45
-12 45
-11 45
-10 45
-9 45
-8 45
-7 45
-6 45
-5 45
-4 45
-3 45
-2 45
-1 45
-0 45
diff --git a/ConsoleApp/Output/HexTest.png b/ConsoleApp/Output/HexTest.png
index 0dccbf7..5a8e26e 100644
Binary files a/ConsoleApp/Output/HexTest.png and b/ConsoleApp/Output/HexTest.png differ
diff --git a/ConsoleApp/Output/Mines.txt b/ConsoleApp/Output/Mines.txt
new file mode 100644
index 0000000..2cea69e
--- /dev/null
+++ b/ConsoleApp/Output/Mines.txt
@@ -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
diff --git a/ConsoleApp/Output/SquareCoverage.png b/ConsoleApp/Output/SquareCoverage.png
new file mode 100644
index 0000000..4cc6159
Binary files /dev/null and b/ConsoleApp/Output/SquareCoverage.png differ
diff --git a/ConsoleApp/Output/SquareCoveredCells.txt b/ConsoleApp/Output/SquareCoveredCells.txt
new file mode 100644
index 0000000..9011f5d
--- /dev/null
+++ b/ConsoleApp/Output/SquareCoveredCells.txt
@@ -0,0 +1,1996 @@
+0 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 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 37
+0 38
+0 39
+0 40
+0 41
+0 42
+0 43
+1 0
+1 1
+1 2
+1 3
+1 4
+1 5
+1 6
+1 7
+1 8
+1 9
+1 10
+1 11
+1 12
+1 13
+1 14
+1 15
+1 16
+1 17
+1 18
+1 19
+1 21
+1 22
+1 23
+1 24
+1 25
+1 26
+1 27
+1 28
+1 29
+1 30
+1 31
+1 32
+1 33
+1 34
+1 35
+1 37
+1 38
+1 39
+1 40
+1 41
+1 42
+1 43
+2 0
+2 1
+2 2
+2 3
+2 4
+2 5
+2 6
+2 7
+2 8
+2 9
+2 10
+2 11
+2 12
+2 13
+2 14
+2 15
+2 16
+2 17
+2 18
+2 19
+2 21
+2 22
+2 23
+2 24
+2 25
+2 26
+2 27
+2 28
+2 29
+2 30
+2 31
+2 32
+2 33
+2 34
+2 35
+2 36
+2 37
+2 38
+2 39
+2 40
+2 41
+2 42
+2 43
+2 44
+2 45
+2 46
+3 0
+3 1
+3 2
+3 3
+3 4
+3 5
+3 6
+3 7
+3 8
+3 9
+3 10
+3 11
+3 12
+3 13
+3 14
+3 15
+3 16
+3 17
+3 18
+3 19
+3 21
+3 22
+3 23
+3 24
+3 25
+3 26
+3 27
+3 28
+3 29
+3 30
+3 31
+3 32
+3 33
+3 34
+3 35
+3 36
+3 37
+3 38
+3 39
+3 40
+3 41
+3 42
+3 43
+3 44
+3 45
+3 46
+4 0
+4 1
+4 2
+4 3
+4 4
+4 5
+4 6
+4 7
+4 8
+4 9
+4 10
+4 13
+4 14
+4 15
+4 16
+4 17
+4 18
+4 19
+4 21
+4 22
+4 23
+4 24
+4 25
+4 26
+4 27
+4 28
+4 29
+4 30
+4 31
+4 32
+4 33
+4 34
+4 35
+4 36
+4 37
+4 38
+4 39
+4 40
+4 41
+4 42
+4 43
+4 44
+4 45
+4 46
+5 0
+5 1
+5 2
+5 3
+5 4
+5 5
+5 6
+5 7
+5 8
+5 9
+5 10
+5 13
+5 14
+5 15
+5 16
+5 17
+5 18
+5 19
+5 21
+5 22
+5 23
+5 24
+5 25
+5 26
+5 27
+5 28
+5 29
+5 30
+5 31
+5 32
+5 33
+5 34
+5 35
+5 36
+5 37
+5 38
+5 39
+5 40
+5 41
+5 42
+5 43
+5 44
+5 45
+5 46
+6 0
+6 1
+6 2
+6 3
+6 4
+6 5
+6 6
+6 7
+6 8
+6 9
+6 10
+6 11
+6 13
+6 14
+6 15
+6 16
+6 17
+6 18
+6 19
+6 20
+6 21
+6 22
+6 23
+6 24
+6 25
+6 26
+6 27
+6 28
+6 29
+6 30
+6 31
+6 32
+6 33
+6 34
+6 35
+6 36
+6 37
+6 38
+6 39
+6 40
+6 41
+6 42
+6 43
+6 44
+6 45
+6 46
+7 0
+7 1
+7 2
+7 3
+7 4
+7 5
+7 6
+7 7
+7 8
+7 9
+7 10
+7 11
+7 13
+7 14
+7 15
+7 16
+7 17
+7 18
+7 19
+7 20
+7 21
+7 22
+7 23
+7 24
+7 25
+7 26
+7 27
+7 28
+7 29
+7 30
+7 31
+7 32
+7 33
+7 34
+7 35
+7 36
+7 37
+7 38
+7 39
+7 40
+7 41
+7 42
+7 43
+7 44
+7 45
+7 46
+8 0
+8 1
+8 2
+8 3
+8 4
+8 5
+8 6
+8 7
+8 8
+8 9
+8 10
+8 11
+8 13
+8 14
+8 15
+8 16
+8 17
+8 18
+8 19
+8 20
+8 21
+8 22
+8 23
+8 24
+8 25
+8 26
+8 27
+8 28
+8 29
+8 30
+8 31
+8 32
+8 33
+8 34
+8 35
+8 36
+8 37
+8 38
+8 39
+8 40
+8 41
+8 42
+8 43
+8 44
+8 45
+8 46
+9 0
+9 1
+9 2
+9 3
+9 4
+9 5
+9 6
+9 7
+9 8
+9 9
+9 10
+9 11
+9 13
+9 14
+9 15
+9 16
+9 17
+9 18
+9 19
+9 20
+9 21
+9 22
+9 23
+9 24
+9 25
+9 26
+9 27
+9 28
+9 29
+9 30
+9 31
+9 32
+9 33
+9 34
+9 35
+9 36
+9 37
+9 38
+9 39
+9 40
+9 41
+9 42
+9 43
+9 44
+9 45
+9 46
+10 0
+10 1
+10 2
+10 3
+10 4
+10 5
+10 6
+10 7
+10 8
+10 9
+10 10
+10 11
+10 13
+10 14
+10 15
+10 16
+10 17
+10 18
+10 19
+10 20
+10 21
+10 22
+10 23
+10 24
+10 25
+10 26
+10 27
+10 28
+10 29
+10 30
+10 31
+10 32
+10 33
+10 34
+10 35
+10 36
+10 37
+10 38
+10 39
+10 40
+10 41
+10 42
+10 43
+10 44
+10 45
+10 46
+11 0
+11 1
+11 2
+11 3
+11 4
+11 5
+11 6
+11 7
+11 8
+11 9
+11 10
+11 11
+11 13
+11 14
+11 15
+11 16
+11 17
+11 18
+11 19
+11 20
+11 21
+11 22
+11 23
+11 24
+11 25
+11 26
+11 27
+11 28
+11 29
+11 30
+11 31
+11 32
+11 33
+11 34
+11 35
+11 36
+11 37
+11 38
+11 39
+11 40
+11 41
+11 42
+11 43
+11 44
+11 45
+11 46
+12 0
+12 1
+12 2
+12 3
+12 4
+12 5
+12 6
+12 7
+12 8
+12 9
+12 10
+12 11
+12 14
+12 15
+12 16
+12 17
+12 18
+12 19
+12 20
+12 21
+12 22
+12 23
+12 24
+12 25
+12 26
+12 27
+12 28
+12 29
+12 30
+12 31
+12 32
+12 33
+12 34
+12 35
+12 36
+12 37
+12 38
+12 39
+12 40
+12 41
+12 42
+12 43
+12 44
+12 45
+12 46
+13 0
+13 1
+13 2
+13 3
+13 4
+13 5
+13 6
+13 7
+13 8
+13 9
+13 10
+13 11
+13 15
+13 16
+13 17
+13 18
+13 19
+13 20
+13 21
+13 22
+13 23
+13 24
+13 25
+13 26
+13 27
+13 28
+13 29
+13 30
+13 31
+13 32
+13 33
+13 34
+13 35
+13 36
+13 37
+13 38
+13 39
+13 40
+13 41
+13 42
+13 43
+13 44
+13 45
+13 46
+14 0
+14 1
+14 2
+14 3
+14 4
+14 5
+14 6
+14 7
+14 8
+14 9
+14 10
+14 11
+14 15
+14 16
+14 17
+14 18
+14 19
+14 20
+14 21
+14 22
+14 23
+14 24
+14 25
+14 26
+14 27
+14 28
+14 29
+14 30
+14 31
+14 32
+14 33
+14 34
+14 35
+14 36
+14 37
+14 38
+14 39
+14 40
+14 41
+14 42
+14 43
+14 44
+14 45
+14 46
+15 0
+15 1
+15 2
+15 3
+15 4
+15 5
+15 6
+15 7
+15 8
+15 9
+15 10
+15 11
+15 15
+15 16
+15 17
+15 18
+15 19
+15 20
+15 21
+15 22
+15 23
+15 24
+15 25
+15 26
+15 27
+15 28
+15 29
+15 30
+15 31
+15 32
+15 33
+15 34
+15 35
+15 36
+15 37
+15 38
+15 39
+15 40
+15 41
+15 42
+15 43
+15 44
+15 45
+15 46
+16 0
+16 1
+16 2
+16 3
+16 4
+16 5
+16 6
+16 7
+16 8
+16 9
+16 10
+16 16
+16 17
+16 18
+16 19
+16 20
+16 22
+16 23
+16 24
+16 25
+16 26
+16 27
+16 28
+16 29
+16 30
+16 31
+16 32
+16 33
+16 34
+16 35
+16 36
+16 37
+16 38
+16 39
+16 40
+16 41
+16 42
+16 43
+16 44
+16 45
+16 46
+17 0
+17 1
+17 2
+17 3
+17 4
+17 5
+17 6
+17 7
+17 8
+17 9
+17 10
+17 21
+17 22
+17 23
+17 24
+17 25
+17 26
+17 27
+17 28
+17 29
+17 30
+17 31
+17 32
+17 33
+17 34
+17 35
+17 36
+17 37
+17 38
+17 39
+17 40
+17 41
+17 42
+17 43
+17 44
+17 45
+17 46
+18 0
+18 1
+18 2
+18 3
+18 4
+18 5
+18 6
+18 7
+18 8
+18 9
+18 10
+18 11
+18 21
+18 22
+18 23
+18 24
+18 25
+18 26
+18 27
+18 28
+18 29
+18 30
+18 31
+18 32
+18 33
+18 34
+18 35
+18 36
+18 37
+18 38
+18 39
+18 40
+18 41
+18 42
+18 43
+18 44
+18 45
+18 46
+19 0
+19 1
+19 2
+19 3
+19 4
+19 5
+19 6
+19 7
+19 8
+19 9
+19 10
+19 11
+19 21
+19 22
+19 23
+19 24
+19 25
+19 26
+19 27
+19 28
+19 29
+19 30
+19 31
+19 32
+19 33
+19 34
+19 35
+19 36
+19 37
+19 38
+19 39
+19 40
+19 41
+19 42
+19 43
+19 44
+19 45
+19 46
+20 0
+20 1
+20 2
+20 3
+20 4
+20 5
+20 6
+20 7
+20 8
+20 9
+20 10
+20 11
+20 21
+20 22
+20 23
+20 24
+20 25
+20 26
+20 27
+20 28
+20 29
+20 30
+20 31
+20 32
+20 33
+20 34
+20 35
+20 36
+20 37
+20 38
+20 39
+20 40
+20 41
+20 42
+21 0
+21 1
+21 2
+21 3
+21 4
+21 5
+21 6
+21 7
+21 8
+21 9
+21 10
+21 11
+21 19
+21 20
+21 21
+21 22
+21 23
+21 24
+21 25
+21 26
+21 27
+21 28
+21 29
+21 30
+21 31
+21 32
+21 33
+21 34
+21 35
+21 36
+21 37
+21 38
+21 39
+21 40
+21 41
+21 42
+22 0
+22 1
+22 2
+22 3
+22 4
+22 5
+22 6
+22 7
+22 8
+22 9
+22 10
+22 11
+22 15
+22 16
+22 17
+22 18
+22 19
+22 20
+22 21
+22 22
+22 23
+22 24
+22 25
+22 26
+22 27
+22 28
+22 29
+22 30
+22 31
+22 32
+22 33
+22 34
+22 35
+22 36
+22 37
+22 38
+22 39
+22 40
+22 41
+22 42
+22 43
+22 44
+23 0
+23 1
+23 2
+23 3
+23 4
+23 5
+23 6
+23 7
+23 8
+23 9
+23 10
+23 11
+23 14
+23 15
+23 16
+23 17
+23 18
+23 19
+23 20
+23 21
+23 22
+23 23
+23 24
+23 25
+23 26
+23 27
+23 28
+23 29
+23 30
+23 31
+23 32
+23 33
+23 34
+23 35
+23 36
+23 37
+23 38
+23 39
+23 40
+23 41
+23 42
+23 43
+23 44
+23 45
+24 0
+24 1
+24 2
+24 3
+24 4
+24 5
+24 6
+24 7
+24 8
+24 9
+24 10
+24 11
+24 14
+24 15
+24 16
+24 17
+24 18
+24 19
+24 20
+24 21
+24 22
+24 23
+24 24
+24 25
+24 26
+24 27
+24 28
+24 29
+24 30
+24 31
+24 32
+24 33
+24 34
+24 35
+24 36
+24 37
+24 38
+24 39
+24 40
+24 41
+24 42
+24 43
+24 44
+24 45
+25 0
+25 1
+25 2
+25 3
+25 5
+25 6
+25 7
+25 8
+25 9
+25 10
+25 11
+25 14
+25 15
+25 16
+25 17
+25 18
+25 19
+25 20
+25 21
+25 22
+25 23
+25 24
+25 25
+25 26
+25 27
+25 28
+25 29
+25 30
+25 31
+25 32
+25 33
+25 34
+25 35
+25 36
+25 37
+25 38
+25 39
+25 40
+25 41
+25 42
+25 43
+25 44
+25 45
+26 0
+26 1
+26 2
+26 3
+26 5
+26 6
+26 7
+26 8
+26 9
+26 10
+26 11
+26 14
+26 15
+26 16
+26 17
+26 18
+26 19
+26 20
+26 21
+26 22
+26 23
+26 24
+26 25
+26 26
+26 27
+26 28
+26 29
+26 30
+26 31
+26 32
+26 33
+26 34
+26 35
+26 36
+26 37
+26 38
+26 39
+26 40
+26 41
+26 42
+26 43
+26 44
+26 45
+27 0
+27 1
+27 2
+27 3
+27 5
+27 6
+27 7
+27 8
+27 9
+27 10
+27 11
+27 14
+27 15
+27 16
+27 17
+27 18
+27 19
+27 20
+27 21
+27 22
+27 23
+27 24
+27 25
+27 26
+27 27
+27 28
+27 29
+27 30
+27 31
+27 32
+27 33
+27 34
+27 35
+27 37
+27 38
+27 39
+27 40
+27 41
+27 42
+27 43
+27 44
+27 45
+28 0
+28 1
+28 2
+28 3
+28 5
+28 6
+28 7
+28 8
+28 9
+28 10
+28 11
+28 15
+28 16
+28 17
+28 18
+28 19
+28 20
+28 21
+28 22
+28 23
+28 24
+28 25
+28 26
+28 27
+28 28
+28 29
+28 30
+28 31
+28 32
+28 33
+28 34
+28 35
+28 38
+28 39
+28 40
+28 41
+28 42
+28 43
+28 44
+28 45
+29 0
+29 1
+29 2
+29 3
+29 5
+29 6
+29 7
+29 8
+29 9
+29 10
+29 11
+29 15
+29 16
+29 17
+29 18
+29 19
+29 20
+29 21
+29 22
+29 23
+29 24
+29 25
+29 26
+29 27
+29 28
+29 29
+29 30
+29 31
+29 32
+29 33
+29 34
+29 35
+29 38
+29 39
+29 40
+29 41
+29 42
+29 43
+29 44
+29 45
+30 0
+30 1
+30 2
+30 3
+30 5
+30 6
+30 7
+30 8
+30 9
+30 10
+30 11
+30 15
+30 16
+30 17
+30 18
+30 19
+30 20
+30 21
+30 22
+30 23
+30 24
+30 25
+30 26
+30 27
+30 28
+30 29
+30 30
+30 31
+30 32
+30 33
+30 34
+30 35
+30 37
+30 38
+30 39
+30 40
+30 41
+30 42
+30 43
+30 44
+30 45
+31 0
+31 1
+31 2
+31 3
+31 5
+31 6
+31 7
+31 8
+31 9
+31 10
+31 11
+31 16
+31 17
+31 18
+31 19
+31 20
+31 21
+31 22
+31 23
+31 24
+31 25
+31 26
+31 27
+31 28
+31 29
+31 30
+31 31
+31 32
+31 33
+31 34
+31 35
+31 37
+31 38
+31 39
+31 40
+31 41
+31 42
+31 43
+31 44
+31 45
+32 0
+32 1
+32 2
+32 3
+32 5
+32 6
+32 7
+32 8
+32 9
+32 10
+32 11
+32 12
+32 13
+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 37
+32 38
+32 39
+32 40
+32 41
+32 42
+32 43
+32 44
+32 45
+33 0
+33 1
+33 2
+33 3
+33 5
+33 6
+33 7
+33 8
+33 9
+33 10
+33 11
+33 12
+33 13
+33 14
+33 15
+33 16
+33 17
+33 18
+33 19
+33 20
+33 22
+33 23
+33 24
+33 25
+33 26
+33 27
+33 28
+33 29
+33 30
+33 31
+33 32
+33 33
+33 34
+33 35
+33 37
+33 38
+33 39
+33 40
+33 41
+33 42
+33 43
+33 44
+33 45
+34 0
+34 1
+34 2
+34 3
+34 5
+34 6
+34 7
+34 8
+34 9
+34 10
+34 11
+34 12
+34 13
+34 14
+34 15
+34 16
+34 17
+34 18
+34 19
+34 20
+34 21
+34 22
+34 23
+34 24
+34 26
+34 27
+34 28
+34 29
+34 30
+34 31
+34 32
+34 33
+34 34
+34 35
+34 37
+34 38
+34 39
+34 40
+34 41
+34 42
+34 43
+34 44
+34 45
+35 0
+35 1
+35 2
+35 3
+35 5
+35 6
+35 7
+35 8
+35 9
+35 10
+35 11
+35 12
+35 13
+35 14
+35 15
+35 16
+35 17
+35 18
+35 19
+35 20
+35 21
+35 22
+35 23
+35 24
+35 25
+35 26
+35 27
+35 28
+35 29
+35 30
+35 31
+35 32
+35 33
+35 34
+35 35
+35 37
+35 38
+35 39
+35 40
+35 41
+35 42
+35 43
+35 44
+36 0
+36 1
+36 2
+36 3
+36 5
+36 6
+36 7
+36 8
+36 9
+36 10
+36 11
+36 12
+36 13
+36 14
+36 15
+36 16
+36 17
+36 18
+36 19
+36 20
+36 21
+36 22
+36 23
+36 24
+36 25
+36 26
+36 27
+36 28
+36 29
+36 30
+36 31
+36 32
+36 33
+36 34
+36 35
+36 37
+36 38
+36 39
+36 40
+36 41
+36 42
+36 43
+36 44
+37 0
+37 1
+37 2
+37 3
+37 5
+37 6
+37 7
+37 8
+37 9
+37 10
+37 11
+37 12
+37 13
+37 14
+37 15
+37 16
+37 17
+37 18
+37 19
+37 20
+37 21
+37 22
+37 23
+37 24
+37 25
+37 26
+37 27
+37 28
+37 29
+37 30
+37 31
+37 32
+37 33
+37 34
+37 35
+37 37
+37 38
+37 39
+37 40
+37 41
+37 42
+37 43
+37 44
+38 0
+38 1
+38 2
+38 3
+38 6
+38 7
+38 8
+38 9
+38 10
+38 11
+38 12
+38 13
+38 14
+38 15
+38 16
+38 17
+38 18
+38 19
+38 20
+38 21
+38 22
+38 23
+38 24
+38 25
+38 26
+38 27
+38 28
+38 29
+38 30
+38 31
+38 32
+38 33
+38 34
+38 35
+38 37
+38 38
+38 39
+38 40
+38 41
+38 42
+38 43
+38 44
+39 0
+39 1
+39 2
+39 3
+39 6
+39 7
+39 8
+39 9
+39 10
+39 11
+39 12
+39 13
+39 14
+39 15
+39 16
+39 17
+39 18
+39 19
+39 20
+39 21
+39 22
+39 23
+39 24
+39 25
+39 26
+39 27
+39 28
+39 29
+39 30
+39 31
+39 32
+39 33
+39 34
+39 35
+39 37
+39 38
+39 39
+39 40
+39 41
+39 42
+39 43
+39 44
+40 0
+40 1
+40 2
+40 3
+40 5
+40 6
+40 7
+40 8
+40 9
+40 10
+40 11
+40 12
+40 13
+40 14
+40 15
+40 16
+40 17
+40 18
+40 19
+40 20
+40 21
+40 22
+40 23
+40 24
+40 25
+40 26
+40 27
+40 28
+40 29
+40 30
+40 31
+40 32
+40 33
+40 34
+40 35
+40 37
+40 38
+40 39
+40 40
+40 41
+40 42
+40 43
+41 0
+41 1
+41 2
+41 3
+41 5
+41 6
+41 7
+41 8
+41 9
+41 10
+41 11
+41 12
+41 13
+41 14
+41 15
+41 16
+41 17
+41 18
+41 19
+41 20
+41 21
+41 22
+41 23
+41 24
+41 25
+41 26
+41 27
+41 28
+41 29
+41 30
+41 31
+41 32
+41 33
+41 34
+41 35
+41 37
+41 38
+41 39
+41 40
+41 41
+41 42
+41 43
+42 0
+42 1
+42 2
+42 3
+42 5
+42 6
+42 7
+42 8
+42 9
+42 10
+42 11
+42 12
+42 13
+42 14
+42 15
+42 16
+42 17
+42 18
+42 19
+42 20
+42 21
+42 22
+42 23
+42 24
+42 25
+42 26
+42 27
+42 28
+42 29
+42 30
+42 31
+42 32
+42 33
+42 34
+42 35
+42 37
+42 38
+42 39
+42 40
+42 41
+42 42
+42 43
+43 0
+43 1
+43 2
+43 3
+43 4
+43 5
+43 6
+43 7
+43 8
+43 9
+43 10
+43 11
+43 12
+43 13
+43 14
+43 15
+43 16
+43 17
+43 18
+43 19
+43 20
+43 21
+43 22
+43 23
+43 24
+43 25
+43 26
+43 27
+43 28
+43 29
+43 30
+43 31
+43 32
+43 33
+43 34
+43 35
+43 36
+43 37
+43 38
+43 39
+43 40
+43 41
+43 42
+43 43
+44 0
+44 1
+44 2
+44 3
+44 4
+44 5
+44 6
+44 7
+44 8
+44 9
+44 10
+44 11
+44 12
+44 13
+44 14
+44 15
+44 16
+44 17
+44 18
+44 19
+44 20
+44 21
+44 22
+44 23
+44 24
+44 25
+44 26
+44 27
+44 28
+44 29
+44 30
+44 31
+44 32
+44 33
+44 34
+44 35
+44 36
+44 37
+44 38
+44 39
+44 40
+44 41
+44 42
+44 43
+45 0
+45 1
+45 2
+45 3
+45 4
+45 5
+45 6
+45 7
+45 8
+45 9
+45 10
+45 11
+45 12
+45 13
+45 14
+45 15
+45 16
+45 17
+45 18
+45 19
+45 20
+45 21
+45 22
+45 23
+45 24
+45 25
+45 26
+45 27
+45 29
+45 30
+45 31
+45 32
+45 33
+45 34
+45 35
+45 36
+45 37
+45 38
+45 39
+45 40
+45 41
+45 42
+45 43
+46 0
+46 1
+46 2
+46 3
+46 4
+46 5
+46 6
+46 7
+46 8
+46 9
+46 10
+46 11
+46 12
+46 13
+46 14
+46 15
+46 16
+46 17
+46 18
+46 19
+46 20
+46 21
+46 22
+46 23
+46 24
+46 25
+46 26
+46 27
+46 29
+46 30
+46 31
+46 32
+46 33
+46 34
+46 35
+46 36
+46 37
+46 38
+46 39
+46 40
+46 41
+46 42
+46 43
diff --git a/ConsoleApp/Output/SquareDetectedMines.txt b/ConsoleApp/Output/SquareDetectedMines.txt
new file mode 100644
index 0000000..07b7790
--- /dev/null
+++ b/ConsoleApp/Output/SquareDetectedMines.txt
@@ -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
diff --git a/ConsoleApp/Output/SquarePath.txt b/ConsoleApp/Output/SquarePath.txt
new file mode 100644
index 0000000..931f5aa
--- /dev/null
+++ b/ConsoleApp/Output/SquarePath.txt
@@ -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
diff --git a/ConsoleApp/Output/SquareTest.png b/ConsoleApp/Output/SquareTest.png
new file mode 100644
index 0000000..2c0e00f
Binary files /dev/null and b/ConsoleApp/Output/SquareTest.png differ
diff --git a/ConsoleApp/PathPlanners/IReactivePathPlanner.cs b/ConsoleApp/PathPlanners/IReactivePathPlanner.cs
index 404d781..9a0845e 100644
--- a/ConsoleApp/PathPlanners/IReactivePathPlanner.cs
+++ b/ConsoleApp/PathPlanners/IReactivePathPlanner.cs
@@ -8,5 +8,10 @@ namespace ConsoleApp.PathPlanners
{
Queue ReactiveHexPath { get; }
void GenerateReactiveHexPath(IHexMap hexMap, Queue optimalPath, Coordinate2D vehicleCurrentHexCell);
+
+ Queue ReactiveSquarePath { get; }
+
+ void GenerateReactiveSquarePath(ISquareMap squareMap, Queue optimalPath,
+ ICell vehicleCurrentSquareCell);
}
}
\ No newline at end of file
diff --git a/ConsoleApp/PathPlanners/PathPlanner.cs b/ConsoleApp/PathPlanners/PathPlanner.cs
index d195b27..508d8b8 100644
--- a/ConsoleApp/PathPlanners/PathPlanner.cs
+++ b/ConsoleApp/PathPlanners/PathPlanner.cs
@@ -11,49 +11,49 @@ namespace ConsoleApp.PathPlanners
{
public Queue GenerateOptimalSquarePath(ISquareMap map, IVehicle vehicle)
{
- var path = new Queue();
- 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();
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(path);
}
public Queue GenerateOptimalHexPath(IHexMap hexMap, IVehicle vehicle)
diff --git a/ConsoleApp/PathPlanners/ReactivePathPlanner.cs b/ConsoleApp/PathPlanners/ReactivePathPlanner.cs
index 258bd4d..9c42596 100644
--- a/ConsoleApp/PathPlanners/ReactivePathPlanner.cs
+++ b/ConsoleApp/PathPlanners/ReactivePathPlanner.cs
@@ -7,12 +7,17 @@ namespace ConsoleApp.PathPlanners
public class ReactivePathPlanner : IReactivePathPlanner
{
private Queue _reactiveHexPath;
+ private Queue _reactiveSquarePath;
public Queue ReactiveHexPath => _reactiveHexPath;
+ public Queue ReactiveSquarePath => _reactiveSquarePath;
+
public ReactivePathPlanner()
{
_reactiveHexPath = new Queue();
+ _reactiveSquarePath = new Queue();
+
}
public void GenerateReactiveHexPath(IHexMap hexMap, Queue optimalPath,
Coordinate2D vehicleCurrentHexCell)
@@ -39,6 +44,33 @@ namespace ConsoleApp.PathPlanners
_reactiveHexPath.Enqueue(node);
}
}
-
+
+
+ public void GenerateReactiveSquarePath(ISquareMap squareMap, Queue 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);
+ }
+ }
}
}
\ No newline at end of file
diff --git a/ConsoleApp/Program.cs b/ConsoleApp/Program.cs
index d90d0e7..044e423 100644
--- a/ConsoleApp/Program.cs
+++ b/ConsoleApp/Program.cs
@@ -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);
+ }
+ }
}
}
\ No newline at end of file
diff --git a/ConsoleApp/Sim/DetectionHead.cs b/ConsoleApp/Sim/DetectionHead.cs
index f9d4c12..14b6390 100644
--- a/ConsoleApp/Sim/DetectionHead.cs
+++ b/ConsoleApp/Sim/DetectionHead.cs
@@ -24,6 +24,6 @@ namespace ConsoleApp.Sim
public static List GetCoveredCells(
ISquareMap squareMap,
Cell centerCell,
- int detectorRadius) => squareMap.GetRange(centerCell, detectorRadius);
+ int detectorRadius) => squareMap.GetRange(centerCell, detectorRadius * 2 - detectorRadius%2);
}
}
\ No newline at end of file
diff --git a/ConsoleApp/Sim/IVehicle.cs b/ConsoleApp/Sim/IVehicle.cs
index 95c1a01..aca35bb 100644
--- a/ConsoleApp/Sim/IVehicle.cs
+++ b/ConsoleApp/Sim/IVehicle.cs
@@ -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; }
}
}
\ No newline at end of file
diff --git a/ConsoleApp/Sim/Vehicle.cs b/ConsoleApp/Sim/Vehicle.cs
index e1424a2..f294bfd 100644
--- a/ConsoleApp/Sim/Vehicle.cs
+++ b/ConsoleApp/Sim/Vehicle.cs
@@ -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; }
diff --git a/ConsoleApp/Sim/VehicleConfiguration.json b/ConsoleApp/Sim/VehicleConfiguration.json
index 8db1cfd..9e1820f 100644
--- a/ConsoleApp/Sim/VehicleConfiguration.json
+++ b/ConsoleApp/Sim/VehicleConfiguration.json
@@ -1,5 +1,5 @@
{
"Length": 1,
"Width": 1,
- "DetectorRadius": 1
+ "DetectorRadius": 2
}
diff --git a/ConsoleApp/SimRunner.cs b/ConsoleApp/SimRunner.cs
index 66a089d..0f4165b 100644
--- a/ConsoleApp/SimRunner.cs
+++ b/ConsoleApp/SimRunner.cs
@@ -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 hexBombsFound = new HashSet();
- private List testingPath = new List();
private ISimulationResults _simulationResults;
+ private HashSet squareBombsFound = new HashSet();
+
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 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
+
}
}
\ No newline at end of file
diff --git a/ConsoleApp/SimulationResults.cs b/ConsoleApp/SimulationResults.cs
index c2a2ca8..d008cfa 100644
--- a/ConsoleApp/SimulationResults.cs
+++ b/ConsoleApp/SimulationResults.cs
@@ -18,6 +18,15 @@ namespace ConsoleApp
public List Mines { get; set; }
public int HexClearedCells { get; set; }
public int HexUnClearedCells { get; set; }
+
+ public List SquarePath { get; set; }
+ public List 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 SquareCoveredCells { get; set; }
+ public List HexCoveredCells { get; set; }
public SimulationResults()
{
@@ -29,6 +38,15 @@ namespace ConsoleApp
Mines = new List| ();
HexClearedCells = 0;
HexUnClearedCells = 0;
+ SquarePath = new List();
+ SquareMappedBombs = new List();
+ SquareCellsUncleared = 0;
+ SquareCellsCleared = 0;
+ SquareBombsFound = 0;
+ SquareTotalMoves = 0;
+ SquareCoveredCells = new List();
+ HexCoveredCells = new List();
+
}
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}");
+ }
+
}
}
}
\ No newline at end of file
| | | | | | | | | | | | |