diff --git a/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml b/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml
index 0e2c1f4..9a12573 100644
--- a/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml
+++ b/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml
@@ -22,7 +22,6 @@
-
diff --git a/.idea/.idea.RobotIntelFinal/.idea/workspace.xml b/.idea/.idea.RobotIntelFinal/.idea/workspace.xml
index 11b2854..9400087 100644
--- a/.idea/.idea.RobotIntelFinal/.idea/workspace.xml
+++ b/.idea/.idea.RobotIntelFinal/.idea/workspace.xml
@@ -15,22 +15,14 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
+
@@ -56,24 +48,24 @@
-
-
-
-
-
+
+
+
+
+
@@ -86,8 +78,11 @@
+
+
+
@@ -137,6 +132,9 @@
1607286398679
+
+
+
@@ -161,31 +159,117 @@
-
+
-
-
+
+
+
+
-
-
+
+
+
+
-
-
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
diff --git a/ConsoleApp/CoreModule.cs b/ConsoleApp/CoreModule.cs
index 49473d5..9829a46 100644
--- a/ConsoleApp/CoreModule.cs
+++ b/ConsoleApp/CoreModule.cs
@@ -1,16 +1,17 @@
using System.Threading;
-using ConsoleApp;
+using ConsoleApp.Maps;
using DryIoc;
-using Module = ConsoleApp.Module;
-namespace Final
+namespace ConsoleApp
{
- public class CoreModule : Module
+ public class CoreModule : IModule
{
- public virtual void Register(IContainer container, ExecutionContext executionContext)
+ public virtual void Register(IContainer container)
{
- //container.Register(Reuse.Singleton);
+ container.Register(Reuse.Singleton);
+ container.Register(Reuse.Singleton);
}
+
public virtual void Resolve(IContainer container)
{
diff --git a/ConsoleApp/Maps/Direction.cs b/ConsoleApp/Maps/Direction.cs
new file mode 100644
index 0000000..833ddf8
--- /dev/null
+++ b/ConsoleApp/Maps/Direction.cs
@@ -0,0 +1,15 @@
+using System;
+
+namespace ConsoleApp.Maps
+{
+ public class Direction
+ {
+ public static Tuple Forward => _forward;
+ public static Tuple Reverse => _reverse;
+
+
+ private static Tuple _forward = new Tuple(1, 0);
+ private static Tuple _reverse = new Tuple(-1, 0);
+
+ }
+}
\ No newline at end of file
diff --git a/ConsoleApp/Maps/Heading.cs b/ConsoleApp/Maps/Heading.cs
new file mode 100644
index 0000000..c46b5c5
--- /dev/null
+++ b/ConsoleApp/Maps/Heading.cs
@@ -0,0 +1,38 @@
+namespace ConsoleApp.Maps
+{
+ public class Heading
+ {
+ private (int, int) _currentHeading;
+ public (int, int) CurrentHeading { get; }
+
+ public void SetHeading((int,int)frontAxel, (int,int)backAxel)
+ {
+ var x = frontAxel.Item1 - backAxel.Item1;
+ var y = frontAxel.Item2 - backAxel.Item2;
+ //forward
+ if (x == 0 && y >= 1) _currentHeading = (0, 1);
+ //backward
+ if (x == 0 && y <= -1) _currentHeading = (0, -1);
+ //right
+ if (x >= 1 && y == 0) _currentHeading = (1, 0);
+ //left
+ if (x <= -1 && y == 0) _currentHeading = (-1, 0);
+ //left, back
+ if (x <= -1 && y <= -1) _currentHeading = (-1, -1);
+ //right, forward
+ if (x >= 1 && y >= 1) _currentHeading = (1, 1);
+ //left, forward
+ if (x <= -1 && y >= 1) _currentHeading = (-1, 1);
+ //right, back
+ if (x >= 1 && y <= -1) _currentHeading = (1, -1);
+
+ }
+ public Heading()
+ {
+ _currentHeading = (1,0);
+ CurrentHeading = _currentHeading;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/ConsoleApp/Maps/HexCell.cs b/ConsoleApp/Maps/HexCell.cs
index 961f0f0..2c3f2a6 100644
--- a/ConsoleApp/Maps/HexCell.cs
+++ b/ConsoleApp/Maps/HexCell.cs
@@ -1,6 +1,6 @@
namespace ConsoleApp
{
- public class HexCell
+ public struct HexCell
{
}
diff --git a/ConsoleApp/Maps/ICell.cs b/ConsoleApp/Maps/ICell.cs
new file mode 100644
index 0000000..7f50db6
--- /dev/null
+++ b/ConsoleApp/Maps/ICell.cs
@@ -0,0 +1,7 @@
+namespace ConsoleApp.Maps
+{
+ public interface ICell
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/ConsoleApp/Maps/IMap.cs b/ConsoleApp/Maps/IMap.cs
new file mode 100644
index 0000000..1fbbdad
--- /dev/null
+++ b/ConsoleApp/Maps/IMap.cs
@@ -0,0 +1,9 @@
+using System.Collections.Generic;
+
+namespace ConsoleApp.Maps
+{
+ public interface IMap
+ {
+ public List PossibleMoves();
+ }
+}
\ No newline at end of file
diff --git a/ConsoleApp/Maps/IMapManager.cs b/ConsoleApp/Maps/IMapManager.cs
new file mode 100644
index 0000000..286faa9
--- /dev/null
+++ b/ConsoleApp/Maps/IMapManager.cs
@@ -0,0 +1,7 @@
+namespace ConsoleApp.Maps
+{
+ public interface IMapManager
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/ConsoleApp/Maps/ISquareCell.cs b/ConsoleApp/Maps/ISquareCell.cs
index 7b118a5..2ef5168 100644
--- a/ConsoleApp/Maps/ISquareCell.cs
+++ b/ConsoleApp/Maps/ISquareCell.cs
@@ -1,7 +1,8 @@
namespace ConsoleApp.Maps
{
- public interface ISquareCell
+ public interface ISquareCell : ICell
{
-
+ int X { get; }
+ int Y { get; }
}
}
\ No newline at end of file
diff --git a/ConsoleApp/Maps/MapFactory.cs b/ConsoleApp/Maps/MapFactory.cs
index 2ca6254..5f4d1dc 100644
--- a/ConsoleApp/Maps/MapFactory.cs
+++ b/ConsoleApp/Maps/MapFactory.cs
@@ -14,7 +14,7 @@ namespace ConsoleApp.Maps
{
Width = x;
Height = y;
- throw new System.NotImplementedException();
+ new SquareMap(x, y);
}
public MapFactory()
diff --git a/ConsoleApp/Maps/MapManager.cs b/ConsoleApp/Maps/MapManager.cs
new file mode 100644
index 0000000..ebdb476
--- /dev/null
+++ b/ConsoleApp/Maps/MapManager.cs
@@ -0,0 +1,6 @@
+namespace ConsoleApp.Maps
+{
+ public class MapManager : IMapManager
+ {
+ }
+}
\ No newline at end of file
diff --git a/ConsoleApp/Maps/SquareCell.cs b/ConsoleApp/Maps/SquareCell.cs
index 051bb42..d237b5d 100644
--- a/ConsoleApp/Maps/SquareCell.cs
+++ b/ConsoleApp/Maps/SquareCell.cs
@@ -1,7 +1,14 @@
namespace ConsoleApp.Maps
{
- public class SquareCell
+ public struct SquareCell : ISquareCell
{
-
+ public int X { get; }
+ public int Y { get; }
+
+ public SquareCell(int x, int y)
+ {
+ X = x;
+ Y = y;
+ }
}
}
\ No newline at end of file
diff --git a/ConsoleApp/Maps/SquareMap.cs b/ConsoleApp/Maps/SquareMap.cs
index 90511c3..a0583e5 100644
--- a/ConsoleApp/Maps/SquareMap.cs
+++ b/ConsoleApp/Maps/SquareMap.cs
@@ -1,7 +1,37 @@
+using System;
+using System.Collections.Generic;
+
namespace ConsoleApp.Maps
{
- public class SquareMap
+ public class SquareMap : ISquareMap
{
-
+ public SquareCell[,] Map { get;}
+
+ public SquareMap(int x, int y)
+ {
+ Map = new SquareCell[x,y];
+ for (int i = 0; i < x; i++)
+ {
+ for (int j = 0; j < y; j++)
+ {
+ Map[i,j] = new SquareCell(i, j);
+ }
+ }
+ }
+
+ public List PossibleMoves(SquareCell myCell)
+ {
+ var forward = (myCell.X , myCell.Y + 1);
+ var backwards= (myCell.X , myCell.Y - 1);
+ var right = (myCell.X + 1, myCell.Y);
+ var left = (myCell.X - 1, myCell.Y);
+ var possibles = new List();
+ possibles.Add(Map[forward.Item1, forward.Item2]);
+ possibles.Add(Map[backwards.Item1, backwards.Item2]);
+ possibles.Add(Map[right.Item1, right.Item2]);
+ possibles.Add(Map[left.Item1, left.Item2]);
+
+ return possibles;
+ }
}
}
\ No newline at end of file
diff --git a/ConsoleApp/Module.cs b/ConsoleApp/Module.cs
deleted file mode 100644
index d4a31e6..0000000
--- a/ConsoleApp/Module.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Collections.Generic;
-
-using DryIoc;
-
-namespace ConsoleApp
-{
- public abstract class Module : IModule
- {
- public virtual void Register(IContainer container)
- {
- }
-
- public virtual void Resolve(IContainer container)
- {
- }
- }
-}
\ No newline at end of file
diff --git a/ConsoleApp/Program.cs b/ConsoleApp/Program.cs
index 6fb7869..247c69f 100644
--- a/ConsoleApp/Program.cs
+++ b/ConsoleApp/Program.cs
@@ -10,12 +10,12 @@ namespace ConsoleApp
static void Main(string[] args)
{
- _bootstrapper = new BootStrapper();
+ _bootstrapper = BootStrapper.BootstrapSystem(new CoreModule());
_userConsole = new UserConsole();
- StartSimulation();
+ Initialization();
}
- private static void StartSimulation()
+ private static void Initialization()
{
_userConsole.PrintStartMenu();
var input = _userConsole.GetUserInput();
@@ -27,14 +27,14 @@ namespace ConsoleApp
else
{
_userConsole.PrintInvalidInput();
- StartSimulation();
+ Initialization();
}
}
private static void RunSimulation(int x,int y)
{
- var simRunner = _bootstrapper.Resolve();
var mapFactory = _bootstrapper.Resolve();
+ var simRunner = _bootstrapper.Resolve();
mapFactory.GenerateMaps(x, y);
simRunner.Run();
diff --git a/ConsoleApp/UserConsole.cs b/ConsoleApp/UserConsole.cs
index 9f824d3..33f2d23 100644
--- a/ConsoleApp/UserConsole.cs
+++ b/ConsoleApp/UserConsole.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Linq;
using ConsoleApp.Maps;
@@ -28,18 +29,22 @@ namespace ConsoleApp
public (int width, int height) GetMapDimensions()
{
- Console.WriteLine($"Enter Dimensions of map/area to clear as (x, y)");
- var input = GetUserInput();
- var numbers = input.Split();
- if (numbers.Length != 4)
+ Console.WriteLine($"Enter map height: ");
+ var x = GetUserInput();
+
+ if (!int.TryParse(x, out var width))
{
PrintInvalidInput();
GetMapDimensions();
}
- var parsedNumbers = numbers.Where(x => !(x.Equals("(") || x.Equals(")"))).ToList();
- int.TryParse(parsedNumbers[0], out var width);
- int.TryParse(parsedNumbers[1], out var height);
+ Console.WriteLine($"Enter map height: ");
+ var y = GetUserInput();
+ if(!int.TryParse(y, out var height))
+ {
+ PrintInvalidInput();
+ GetMapDimensions();
+ }
return (width, height);
}
}
diff --git a/RobotIntelFinal.sln.DotSettings.user b/RobotIntelFinal.sln.DotSettings.user
new file mode 100644
index 0000000..fb23c2a
--- /dev/null
+++ b/RobotIntelFinal.sln.DotSettings.user
@@ -0,0 +1,3 @@
+
+ 1048576
+ /Users/brady.bodily/.dotnet/sdk/3.1.402/MSBuild.dll
\ No newline at end of file