diff --git a/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml b/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml
index 9a12573..1a4249f 100644
--- a/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml
+++ b/.idea/.idea.RobotIntelFinal/.idea/contentModel.xml
@@ -11,10 +11,14 @@
+
+
+
+
diff --git a/.idea/.idea.RobotIntelFinal/.idea/workspace.xml b/.idea/.idea.RobotIntelFinal/.idea/workspace.xml
index 9400087..5c35923 100644
--- a/.idea/.idea.RobotIntelFinal/.idea/workspace.xml
+++ b/.idea/.idea.RobotIntelFinal/.idea/workspace.xml
@@ -15,14 +15,19 @@
+
-
+
+
+
+
+
+
+
+
-
-
-
@@ -51,21 +56,27 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -82,6 +93,7 @@
+
@@ -134,7 +146,7 @@
-
+
@@ -159,101 +171,101 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
-
-
+
+
-
+
diff --git a/ConsoleApp/Maps/HexCell.cs b/ConsoleApp/Maps/HexCell.cs
index 8466a88..d396ff0 100644
--- a/ConsoleApp/Maps/HexCell.cs
+++ b/ConsoleApp/Maps/HexCell.cs
@@ -5,15 +5,15 @@ namespace ConsoleApp.Maps
{
public struct HexCell : IHexCell
{
- public int Q { get; }
- public int R { get; }
- public int S { get; }
+ public int X { get; }
+ public int Y { get; }
+ public int Z { get; }
public HexCell(int q, int r, int s)
{
if (q + r + s != 0) throw new ArgumentException("q + r + s must be 0");
- Q = q;
- R = r;
- S = s;
+ X = q;
+ Y = r;
+ Z = s;
}
}
diff --git a/ConsoleApp/Maps/HexMap.cs b/ConsoleApp/Maps/HexMap.cs
index 2ed8bd6..241f32c 100644
--- a/ConsoleApp/Maps/HexMap.cs
+++ b/ConsoleApp/Maps/HexMap.cs
@@ -3,21 +3,23 @@ using System.Collections.Generic;
namespace ConsoleApp.Maps
{
- public class HexMap
+ public class HexMap : IHexMap
{
private HexCell[,] Map { get; }
public HexMap(int x, int y)
{
+ Map = new HexCell[x+1,y+1];
for (int r = 0; r < y; r++) {
int r_offset = Convert.ToInt32(Math.Floor(Convert.ToDouble(r)/2));
- for (int q = -r_offset; q < x - r_offset; q++) {
+ for (int q = r_offset; q < x - r_offset; q++) {
+ // Console.WriteLine($"r:{r}, q:{q}-----x:{x}, y:{y}");
Map[r, q] = new HexCell(q, r, -q-r);
}
}
}
- public List PossibleMoves(HexCell fromCell, Direction direction, Double orientation)
+ public List PossibleMoves(ICell currentCell)
{
throw new NotImplementedException();
}
diff --git a/ConsoleApp/Maps/ICell.cs b/ConsoleApp/Maps/ICell.cs
index 7f50db6..034be3f 100644
--- a/ConsoleApp/Maps/ICell.cs
+++ b/ConsoleApp/Maps/ICell.cs
@@ -2,6 +2,8 @@ namespace ConsoleApp.Maps
{
public interface ICell
{
-
+ int X { get; }
+ int Y { get; }
+ int Z { get; }
}
}
\ No newline at end of file
diff --git a/ConsoleApp/Maps/IHexMap.cs b/ConsoleApp/Maps/IHexMap.cs
index e183efe..b4cd82f 100644
--- a/ConsoleApp/Maps/IHexMap.cs
+++ b/ConsoleApp/Maps/IHexMap.cs
@@ -1,6 +1,6 @@
namespace ConsoleApp.Maps
{
- public interface IHexMap
+ public interface IHexMap : IMap
{
}
diff --git a/ConsoleApp/Maps/IMap.cs b/ConsoleApp/Maps/IMap.cs
index 1fbbdad..e2010ed 100644
--- a/ConsoleApp/Maps/IMap.cs
+++ b/ConsoleApp/Maps/IMap.cs
@@ -4,6 +4,6 @@ namespace ConsoleApp.Maps
{
public interface IMap
{
- public List PossibleMoves();
+ public List PossibleMoves(ICell currentCell);
}
}
\ No newline at end of file
diff --git a/ConsoleApp/Maps/IMapFactory.cs b/ConsoleApp/Maps/IMapFactory.cs
index 6630a5b..079298d 100644
--- a/ConsoleApp/Maps/IMapFactory.cs
+++ b/ConsoleApp/Maps/IMapFactory.cs
@@ -1,3 +1,4 @@
+using System.Collections.Generic;
using System.Dynamic;
namespace ConsoleApp.Maps
@@ -6,7 +7,7 @@ namespace ConsoleApp.Maps
{
int Height { get; }
int Width { get; }
- SquareMap SquareMap { get; }
+ Dictionary Maps { get; }
void GenerateMaps(int x, int y);
}
}
\ No newline at end of file
diff --git a/ConsoleApp/Maps/ISquareCell.cs b/ConsoleApp/Maps/ISquareCell.cs
index 2ef5168..ae83d9e 100644
--- a/ConsoleApp/Maps/ISquareCell.cs
+++ b/ConsoleApp/Maps/ISquareCell.cs
@@ -2,7 +2,7 @@ namespace ConsoleApp.Maps
{
public interface ISquareCell : ICell
{
- int X { get; }
- int Y { get; }
+ new int X { get; }
+ new int Y { get; }
}
}
\ No newline at end of file
diff --git a/ConsoleApp/Maps/ISquareMap.cs b/ConsoleApp/Maps/ISquareMap.cs
index 494a3b5..ccdd19a 100644
--- a/ConsoleApp/Maps/ISquareMap.cs
+++ b/ConsoleApp/Maps/ISquareMap.cs
@@ -1,6 +1,6 @@
namespace ConsoleApp.Maps
{
- public interface ISquareMap
+ public interface ISquareMap : IMap
{
}
diff --git a/ConsoleApp/Maps/MapFactory.cs b/ConsoleApp/Maps/MapFactory.cs
index 5f4d1dc..0d55898 100644
--- a/ConsoleApp/Maps/MapFactory.cs
+++ b/ConsoleApp/Maps/MapFactory.cs
@@ -1,3 +1,5 @@
+using System.Collections.Generic;
+
namespace ConsoleApp.Maps
{
public class MapFactory : IMapFactory
@@ -6,15 +8,16 @@ namespace ConsoleApp.Maps
private int _defaultWidth;
public int Height { get; protected set; }
public int Width { get; protected set; }
- public SquareMap SquareMap { get; }
- public HexMap HexMap { get; }
-
-
+
+ public Dictionary Maps { get; }
+
+
public void GenerateMaps(int x, int y)
{
Width = x;
Height = y;
- new SquareMap(x, y);
+ Maps.Add("SquareMap",new SquareMap(x, y));
+ Maps.Add("HexMap", new HexMap(x, y));
}
public MapFactory()
@@ -23,6 +26,7 @@ namespace ConsoleApp.Maps
_defaultWidth = 0;
Height = _defaultHeight;
Width = _defaultWidth;
+ Maps = new Dictionary();
}
}
diff --git a/ConsoleApp/Maps/SquareCell.cs b/ConsoleApp/Maps/SquareCell.cs
index d237b5d..ae6fc38 100644
--- a/ConsoleApp/Maps/SquareCell.cs
+++ b/ConsoleApp/Maps/SquareCell.cs
@@ -4,11 +4,13 @@ namespace ConsoleApp.Maps
{
public int X { get; }
public int Y { get; }
+ public int Z { get; }
public SquareCell(int x, int y)
{
X = x;
Y = y;
+ Z = default;
}
}
}
\ No newline at end of file
diff --git a/ConsoleApp/Maps/SquareMap.cs b/ConsoleApp/Maps/SquareMap.cs
index a0583e5..635a3ff 100644
--- a/ConsoleApp/Maps/SquareMap.cs
+++ b/ConsoleApp/Maps/SquareMap.cs
@@ -19,12 +19,12 @@ namespace ConsoleApp.Maps
}
}
- public List PossibleMoves(SquareCell myCell)
+ public List PossibleMoves(ICell currentCell)
{
- 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 forward = (currentCell.X , currentCell.Y + 1);
+ var backwards= (currentCell.X , currentCell.Y - 1);
+ var right = (currentCell.X + 1, currentCell.Y);
+ var left = (currentCell.X - 1, currentCell.Y);
var possibles = new List();
possibles.Add(Map[forward.Item1, forward.Item2]);
possibles.Add(Map[backwards.Item1, backwards.Item2]);
diff --git a/ConsoleApp/SimRunner.cs b/ConsoleApp/SimRunner.cs
index 3821e78..4473388 100644
--- a/ConsoleApp/SimRunner.cs
+++ b/ConsoleApp/SimRunner.cs
@@ -13,7 +13,7 @@ namespace ConsoleApp
public void Run()
{
- throw new System.NotImplementedException();
+
}
}
}
\ No newline at end of file