diff --git a/ConsoleApp/Maps/Direction.cs b/ConsoleApp/Maps/Direction.cs new file mode 100644 index 0000000..c3d2d8b --- /dev/null +++ b/ConsoleApp/Maps/Direction.cs @@ -0,0 +1,7 @@ +namespace ConsoleApp.Maps +{ + public enum Direction + { + Forward, Reverse + } +} \ No newline at end of file diff --git a/ConsoleApp/Maps/HexCell.cs b/ConsoleApp/Maps/HexCell.cs index 961f0f0..4dd5d93 100644 --- a/ConsoleApp/Maps/HexCell.cs +++ b/ConsoleApp/Maps/HexCell.cs @@ -1,7 +1,20 @@ -namespace ConsoleApp +using System; +using System.Collections.Generic; + +namespace ConsoleApp.Maps { - public class HexCell + public struct HexCell { - + public int Q { get; } + public int R { get; } + public int S { 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; + } + } } \ No newline at end of file diff --git a/ConsoleApp/Maps/HexMap.cs b/ConsoleApp/Maps/HexMap.cs index 0f24d36..bc29f22 100644 --- a/ConsoleApp/Maps/HexMap.cs +++ b/ConsoleApp/Maps/HexMap.cs @@ -1,7 +1,25 @@ +using System; +using System.Collections.Generic; + namespace ConsoleApp.Maps { public class HexMap { - + private HexCell[,] Map { get; } + + public HexMap(int x, int y) + { + 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++) { + Map[r, q] = new HexCell(q, r, -q-r); + } + } + } + + public List PossibleMoves(HexCell fromCell, Direction direction, Double orientation) + { + + } } } \ No newline at end of file