Cleaned up some files

This commit is contained in:
2020-12-15 00:37:47 -07:00
parent 257aaa331f
commit 00444fbba9
16 changed files with 93 additions and 124 deletions

View File

@@ -20,7 +20,6 @@
<e p="HexMap.cs" t="Include" /> <e p="HexMap.cs" t="Include" />
<e p="ICell.cs" t="Include" /> <e p="ICell.cs" t="Include" />
<e p="IHexMap.cs" t="Include" /> <e p="IHexMap.cs" t="Include" />
<e p="IMap.cs" t="Include" />
<e p="IMapFactory.cs" t="Include" /> <e p="IMapFactory.cs" t="Include" />
<e p="ISquareMap.cs" t="Include" /> <e p="ISquareMap.cs" t="Include" />
<e p="MapFactory.cs" t="Include" /> <e p="MapFactory.cs" t="Include" />

View File

@@ -18,19 +18,19 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="dafcaeb7-80aa-43a3-a480-786fafb78c0b" name="Default Changelist" comment=""> <list default="true" id="dafcaeb7-80aa-43a3-a480-786fafb78c0b" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.RobotIntelFinal/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/ConsoleApp.csproj" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/ConsoleApp.csproj" afterDir="false" /> <change beforePath="$PROJECT_DIR$/ConsoleApp/IVehicle.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/IVehicle.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/CoreModule.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/CoreModule.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/IPathPlanner.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/PathPlanners/IPathPlanner.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/GlobalDirection.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/GlobalDirection.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/HexMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.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/IHexMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/IHexMap.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/IMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/IMap.cs" afterDir="false" /> <change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/IMap.cs" beforeDir="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/ISquareMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/ISquareMap.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/MapFactory.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/MapFactory.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.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/PathPlanner.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.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/PathPlanners/PathPlanner.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" afterDir="false" /> <change beforePath="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ConsoleApp/Vehicle.cs" beforeDir="false" afterPath="$PROJECT_DIR$/ConsoleApp/Vehicle.cs" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -70,16 +70,22 @@
<option value="$PROJECT_DIR$/ConsoleApp/CoreModule.cs" /> <option value="$PROJECT_DIR$/ConsoleApp/CoreModule.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/IPathPlanner.cs" /> <option value="$PROJECT_DIR$/ConsoleApp/IPathPlanner.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanner.cs" /> <option value="$PROJECT_DIR$/ConsoleApp/PathPlanner.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/IPathPlanner.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/GlobalDirection.cs" /> <option value="$PROJECT_DIR$/ConsoleApp/Maps/GlobalDirection.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/HexCoordinates.cs" /> <option value="$PROJECT_DIR$/ConsoleApp/Maps/HexCoordinates.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/Cell.cs" /> <option value="$PROJECT_DIR$/ConsoleApp/Maps/Cell.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/ICell.cs" /> <option value="$PROJECT_DIR$/ConsoleApp/Maps/ICell.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/MapFactory.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IMapFactory.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/IVehicle.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Vehicle.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/IPathPlanner.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IMap.cs" /> <option value="$PROJECT_DIR$/ConsoleApp/Maps/IMap.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/PathPlanners/PathPlanner.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/ISquareMap.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/SimRunner.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.cs" /> <option value="$PROJECT_DIR$/ConsoleApp/Maps/SquareMap.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs" /> <option value="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs" />
<option value="$PROJECT_DIR$/ConsoleApp/Maps/IHexMap.cs" />
</changedPaths> </changedPaths>
</component> </component>
<component name="ProjectId" id="1lIZ7IfsUjzqV2Jb1obOFvGFAfp" /> <component name="ProjectId" id="1lIZ7IfsUjzqV2Jb1obOFvGFAfp" />
@@ -157,7 +163,7 @@
<workItem from="1607982179018" duration="634000" /> <workItem from="1607982179018" duration="634000" />
<workItem from="1607983288378" duration="86000" /> <workItem from="1607983288378" duration="86000" />
<workItem from="1607983862958" duration="7777000" /> <workItem from="1607983862958" duration="7777000" />
<workItem from="1607993290571" duration="14428000" /> <workItem from="1607993290571" duration="16131000" />
</task> </task>
<servers /> <servers />
</component> </component>
@@ -189,27 +195,14 @@
<line>34</line> <line>34</line>
<properties documentPath="$PROJECT_DIR$/ConsoleApp/PathPlanner.cs" initialLine="34" containingFunctionPresentation="method 'GenerateOptimalSquarePath'"> <properties documentPath="$PROJECT_DIR$/ConsoleApp/PathPlanner.cs" initialLine="34" containingFunctionPresentation="method 'GenerateOptimalSquarePath'">
<startOffsets> <startOffsets>
<option value="1433" /> <option value="1466" />
</startOffsets> </startOffsets>
<endOffsets> <endOffsets>
<option value="1449" /> <option value="1482" />
</endOffsets> </endOffsets>
</properties> </properties>
<option name="timeStamp" value="24" /> <option name="timeStamp" value="24" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" type="DotNet Breakpoints">
<url>file://$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs</url>
<line>62</line>
<properties documentPath="$PROJECT_DIR$/ConsoleApp/Maps/HexMap.cs" initialLine="63" containingFunctionPresentation="constructor 'HexMap'">
<startOffsets>
<option value="2218" />
</startOffsets>
<endOffsets>
<option value="2219" />
</endOffsets>
</properties>
<option name="timeStamp" value="33" />
</line-breakpoint>
</breakpoints> </breakpoints>
</breakpoint-manager> </breakpoint-manager>
</component> </component>

View File

@@ -8,7 +8,7 @@ namespace ConsoleApp
int Width { get; } int Width { get; }
int DetectorOffset { get;} int DetectorOffset { get;}
int DetectorWidth { get;} int DetectorWidth { get;}
ICell CurrentHexCell { get; set; } HexCore.Coordinate2D CurrentHexCell { get; set; }
Heading HexHeading { get; set; } Heading HexHeading { get; set; }
Heading SquareHeading { get; set; } Heading SquareHeading { get; set; }
ICell CurrentSquareCell { get; set; } ICell CurrentSquareCell { get; set; }

View File

@@ -6,12 +6,12 @@ namespace ConsoleApp.Maps
{ {
public class HexMap : IHexMap public class HexMap : IHexMap
{ {
private int _mapHeight;
private int _mapWidth; public int Width { get; }
public Cell[,] Map { get; }
public Cell StartingCell { get; } public int Height { get; }
public Cell LastCell { get; }
public Graph HexGraph { get; } public Graph Graph { get; }
/// <summary> /// <summary>
/// Generate Hex map with cells of 25cm X 25cm /// Generate Hex map with cells of 25cm X 25cm
@@ -28,25 +28,12 @@ namespace ConsoleApp.Maps
var xCellCount = (int)Math.Ceiling((decimal) (x) / 25); var xCellCount = (int)Math.Ceiling((decimal) (x) / 25);
var yCellCount = (int)Math.Ceiling((decimal) (y) / 25); var yCellCount = (int)Math.Ceiling((decimal) (y) / 25);
_mapHeight = yCellCount; Height = yCellCount;
_mapWidth = xCellCount; Width = xCellCount;
//Initialize Map
Map = new Cell[xCellCount, yCellCount];
//set Starting cell;
StartingCell = Map[0, 0];
var unclearedTerrain = new TerrainType(1, "uncleared"); var unclearedTerrain = new TerrainType(1, "uncleared");
var clearedTerrain = new TerrainType(2, "cleared"); var clearedTerrain = new TerrainType(2, "cleared");
//Populate Map
var list = new List<CellState>();
for (int i = 0; i < _mapHeight; i++)
{
for (int j = 0; j < _mapWidth; j++)
{
list.Add(new CellState(false, new Coordinate2D(i, j, OffsetTypes.OddRowsRight), unclearedTerrain));
}
}
var movement = new MovementType(1, "default"); var movement = new MovementType(1, "default");
var movementTypes = new MovementTypes( var movementTypes = new MovementTypes(
new ITerrainType[] { unclearedTerrain, clearedTerrain }, new ITerrainType[] { unclearedTerrain, clearedTerrain },
@@ -59,24 +46,8 @@ namespace ConsoleApp.Maps
} }
} }
); );
HexGraph = GraphFactory.CreateRectangularGraph(_mapWidth, _mapHeight, movementTypes, unclearedTerrain); Graph = GraphFactory.CreateRectangularGraph(Width, Height, movementTypes, unclearedTerrain);
} }
public List<GlobalDirection> PossibleMoves(ICell currentCell)
{
var x = currentCell.X;
var y = currentCell.Y;
var possibles = new List<GlobalDirection>();
if(currentCell.Y != _mapHeight)
possibles.Add(GlobalDirection.North);
if(currentCell.Y != 0)
possibles.Add(GlobalDirection.South);
if(currentCell.X != _mapWidth && currentCell.Y != _mapHeight)
possibles.Add(GlobalDirection.NorthEast);
return possibles;
}
} }
} }

View File

@@ -1,7 +1,9 @@
using HexCore;
namespace ConsoleApp.Maps namespace ConsoleApp.Maps
{ {
public interface IHexMap : IMap public interface IHexMap
{ {
Graph Graph { get; }
} }
} }

View File

@@ -1,16 +0,0 @@
using System.Collections.Generic;
using System.ComponentModel;
using HexCore;
namespace ConsoleApp.Maps
{
public interface IMap
{
public Cell[,] Map { get; }
Cell StartingCell { get; }
Cell LastCell { get; }
public List<GlobalDirection> PossibleMoves(ICell currentCell);
Graph HexGraph { get; }
}
}

View File

@@ -8,7 +8,8 @@ namespace ConsoleApp.Maps
int Height { get; } int Height { get; }
int Width { get; } int Width { get; }
int CellWidth { get; } int CellWidth { get; }
Dictionary<string, IMap> Maps { get; }
void GenerateMaps(int x, int y); void GenerateMaps(int x, int y);
IHexMap GetHexMap();
ISquareMap GetSquareMap();
} }
} }

View File

@@ -1,7 +1,16 @@
using System.Collections.Generic;
using HexCore;
namespace ConsoleApp.Maps namespace ConsoleApp.Maps
{ {
public interface ISquareMap : IMap public interface ISquareMap
{ {
Cell[,] Map { get; }
Cell StartingCell { get; }
Cell LastCell { get; }
List<GlobalDirection> PossibleMoves(ICell currentCell);
Cell GetCell(int x, int y);
int Height { get; }
int Width { get; }
} }
} }

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace ConsoleApp.Maps namespace ConsoleApp.Maps
@@ -8,18 +9,23 @@ namespace ConsoleApp.Maps
private int _defaultWidth; private int _defaultWidth;
public int Height { get; protected set; } public int Height { get; protected set; }
public int Width { get; protected set; } public int Width { get; protected set; }
public int CellWidth { get; protected set; } public int CellWidth { get; }
public Dictionary<string, IMap> Maps { get; }
private ISquareMap _squareMap;
private IHexMap _hexMap;
public void GenerateMaps(int x, int y) public void GenerateMaps(int x, int y)
{ {
Width = x; Width = x;
Height = y; Height = y;
Maps.Add("SquareMap",new SquareMap(x, y)); _squareMap = new SquareMap(x, y);
Maps.Add("HexMap", new HexMap(x, y)); _hexMap = new HexMap(x, y);
} }
public IHexMap GetHexMap() => _hexMap ?? throw new NullReferenceException("hex map not initialized");
public ISquareMap GetSquareMap() => _squareMap ?? throw new NullReferenceException("square map not initialized");
public MapFactory(IVehicle vehicle) public MapFactory(IVehicle vehicle)
{ {
@@ -28,7 +34,8 @@ namespace ConsoleApp.Maps
_defaultWidth = 0; _defaultWidth = 0;
Height = _defaultHeight; Height = _defaultHeight;
Width = _defaultWidth; Width = _defaultWidth;
Maps = new Dictionary<string, IMap>(); _hexMap = default;
_squareMap = default;
} }
} }

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using HexCore; using HexCore;
using ImTools;
namespace ConsoleApp.Maps namespace ConsoleApp.Maps
{ {
@@ -12,9 +13,11 @@ namespace ConsoleApp.Maps
public int Height { get; } public int Height { get; }
public int Width { get; } public int Width { get; }
/// <summary>
private int _mapWidth; /// Returns a map with square cells
private int _mapHeight; /// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
public SquareMap(int x, int y) public SquareMap(int x, int y)
{ {
HexGraph = default; HexGraph = default;
@@ -25,11 +28,10 @@ namespace ConsoleApp.Maps
var xCellCount = (int)Math.Ceiling((decimal) (x) / 25); var xCellCount = (int)Math.Ceiling((decimal) (x) / 25);
var yCellCount = (int)Math.Ceiling((decimal) (y) / 25); var yCellCount = (int)Math.Ceiling((decimal) (y) / 25);
//set Width and height fields and Properties //set Width and height Properties
_mapWidth = xCellCount-1; Width = xCellCount-1;
_mapHeight = yCellCount-1; Height = yCellCount-1;
Height = _mapHeight;
Width = _mapWidth;
//Initialize Map //Initialize Map
Map = new Cell[xCellCount, yCellCount]; Map = new Cell[xCellCount, yCellCount];
@@ -52,18 +54,19 @@ namespace ConsoleApp.Maps
var possibles = new List<GlobalDirection>(); var possibles = new List<GlobalDirection>();
if (currentCell.X != 0) if (currentCell.X != 0)
possibles.Add(GlobalDirection.West); possibles.Add(GlobalDirection.West);
if (currentCell.X != _mapWidth) if (currentCell.X != Width)
possibles.Add(GlobalDirection.East); possibles.Add(GlobalDirection.East);
if (currentCell.Y != _mapHeight) if (currentCell.Y != Height)
possibles.Add(GlobalDirection.North); possibles.Add(GlobalDirection.North);
if (currentCell.Y != 0) if (currentCell.Y != 0)
possibles.Add(GlobalDirection.South); possibles.Add(GlobalDirection.South);
return possibles; return possibles;
} }
public Graph HexGraph { get; } public Graph HexGraph { get; }
public Cell this[in int x, in int y] => Map[x, y]; public Cell GetCell(int x, int y) => Map[x, y];
} }
} }

View File

@@ -5,7 +5,7 @@ namespace ConsoleApp.PathPlanners
{ {
public interface IPathPlanner public interface IPathPlanner
{ {
Queue<ICell> GenerateOptimalSquarePath(SquareMap map, IVehicle vehicle); Queue<ICell> GenerateOptimalSquarePath(ISquareMap map, IVehicle vehicle);
Queue<ICell> GenerateOptimalHexPath(HexMap hexMap, IVehicle vehicle); Queue<ICell> GenerateOptimalHexPath(HexMap hexMap, IVehicle vehicle);
} }

View File

@@ -6,7 +6,7 @@ namespace ConsoleApp.PathPlanners
{ {
public class PathPlanner : IPathPlanner public class PathPlanner : IPathPlanner
{ {
public Queue<ICell> GenerateOptimalSquarePath(SquareMap map, IVehicle vehicle) public Queue<ICell> GenerateOptimalSquarePath(ISquareMap map, IVehicle vehicle)
{ {
var path = new Queue<ICell>(); var path = new Queue<ICell>();
var myCell = map.StartingCell; var myCell = map.StartingCell;
@@ -20,13 +20,13 @@ namespace ConsoleApp.PathPlanners
if (availableMoves.Contains(GlobalDirection.North) && currentHeading == GlobalDirection.North && if (availableMoves.Contains(GlobalDirection.North) && currentHeading == GlobalDirection.North &&
myCell.Y != map.Height) myCell.Y != map.Height)
{ {
path.Enqueue(map[myCell.X, myCell.Y + 1]); path.Enqueue(map.GetCell(myCell.X, myCell.Y + 1));
myCell = map[myCell.X, myCell.Y + 1]; myCell = map.GetCell(myCell.X, myCell.Y + 1);
} }
else if (availableMoves.Contains(GlobalDirection.South) && currentHeading == GlobalDirection.South && myCell.Y != 0) else if (availableMoves.Contains(GlobalDirection.South) && currentHeading == GlobalDirection.South && myCell.Y != 0)
{ {
path.Enqueue(map[myCell.X, myCell.Y - 1]); path.Enqueue(map.GetCell(myCell.X, myCell.Y - 1));
myCell = map[myCell.X, myCell.Y - 1]; myCell = map.GetCell(myCell.X, myCell.Y - 1);
} }
else else
{ {
@@ -38,9 +38,9 @@ namespace ConsoleApp.PathPlanners
{ {
for (int i = myCell.X; i < myCell.X + swathOffset; i++) for (int i = myCell.X; i < myCell.X + swathOffset; i++)
{ {
path.Enqueue(map[i, myCell.Y]); path.Enqueue(map.GetCell(i, myCell.Y));
} }
myCell = map[myCell.X+swathOffset, myCell.Y]; myCell = map.GetCell(myCell.X+swathOffset, myCell.Y);
if (currentHeading == GlobalDirection.North) if (currentHeading == GlobalDirection.North)
currentHeading = GlobalDirection.South; currentHeading = GlobalDirection.South;
else if (currentHeading == GlobalDirection.South) else if (currentHeading == GlobalDirection.South)
@@ -52,7 +52,7 @@ namespace ConsoleApp.PathPlanners
return path; return path;
} }
public Queue<ICell> GenerateOptimalHexPath(HexMap hexMap, IVehicle vehicle) public Queue<ICell> GenerateOptimalHexPath(HexMap hexMap, IVehicle vehicle)
{ {
throw new NotImplementedException(); throw new NotImplementedException();

View File

@@ -13,6 +13,7 @@ namespace ConsoleApp
_bootstrapper = BootStrapper.BootstrapSystem(new CoreModule()); _bootstrapper = BootStrapper.BootstrapSystem(new CoreModule());
_userConsole = new UserConsole(); _userConsole = new UserConsole();
Initialization(); Initialization();
Console.WriteLine("Program Completed");
} }
private static void Initialization() private static void Initialization()

View File

@@ -4,6 +4,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using ConsoleApp.Maps; using ConsoleApp.Maps;
using ConsoleApp.PathPlanners; using ConsoleApp.PathPlanners;
using HexCore;
namespace ConsoleApp namespace ConsoleApp
{ {
@@ -28,7 +29,7 @@ namespace ConsoleApp
public void Run() public void Run()
{ {
//SquareSimulation(); SquareSimulation();
HexSimulation(); HexSimulation();
// while(!squareTask.IsCompleted && !hexTask.IsCompleted){Thread.Sleep(500);} // while(!squareTask.IsCompleted && !hexTask.IsCompleted){Thread.Sleep(500);}
@@ -36,15 +37,15 @@ namespace ConsoleApp
private void HexSimulation() private void HexSimulation()
{ {
var hexMap = (HexMap)_mapFactory.Maps["HexMap"]; var hexMap = _mapFactory.GetHexMap();
_vehicle.CurrentHexCell = hexMap.StartingCell; _vehicle.CurrentHexCell = new Coordinate2D(0, 0, OffsetTypes.OddRowsRight);
var optimalPath = _pathPlanner.GenerateOptimalHexPath(hexMap, _vehicle); //var optimalPath = _pathPlanner.GenerateOptimalHexPath(hexMap, _vehicle);
} }
private void SquareSimulation() private void SquareSimulation()
{ {
var squareMap = (SquareMap)_mapFactory.Maps["SquareMap"]; var squareMap = _mapFactory.GetSquareMap();
_vehicle.CurrentSquareCell = squareMap.StartingCell; _vehicle.CurrentSquareCell = squareMap.StartingCell;
var optimalPath = _pathPlanner.GenerateOptimalSquarePath(squareMap, _vehicle); var optimalPath = _pathPlanner.GenerateOptimalSquarePath(squareMap, _vehicle);
} }

View File

@@ -7,8 +7,6 @@ namespace ConsoleApp
{ {
public class UserConsole : IUserConsole public class UserConsole : IUserConsole
{ {
private IMapFactory _mapFactory;
public UserConsole() public UserConsole()
{ {
} }

View File

@@ -10,7 +10,7 @@ namespace ConsoleApp
public int DetectorOffset { get;} public int DetectorOffset { get;}
public int DetectorWidth { get;} public int DetectorWidth { get;}
public ICell CurrentHexCell { get; set; } public HexCore.Coordinate2D CurrentHexCell { get; set; }
public Heading HexHeading { get; set; } public Heading HexHeading { get; set; }
public Heading SquareHeading { get; set; } public Heading SquareHeading { get; set; }
public ICell CurrentSquareCell { get; set; } public ICell CurrentSquareCell { get; set; }