From 230e97e3dfacbae1d0c07b04baa03429ec72c73d Mon Sep 17 00:00:00 2001 From: zac johnson Date: Thu, 10 Dec 2020 16:48:34 -0700 Subject: [PATCH 01/13] Start of hex cell --- ConsoleApp/Maps/Direction.cs | 7 +++++++ ConsoleApp/Maps/HexCell.cs | 19 ++++++++++++++++--- ConsoleApp/Maps/HexMap.cs | 20 +++++++++++++++++++- 3 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 ConsoleApp/Maps/Direction.cs 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 From 63f158afd9a458d8389d86d5e4de519f6093d88f Mon Sep 17 00:00:00 2001 From: Brady Bodily Date: Thu, 10 Dec 2020 20:07:23 -0700 Subject: [PATCH 02/13] backing up --- .../.idea/contentModel.xml | 1 - .../.idea.RobotIntelFinal/.idea/workspace.xml | 142 ++++++++++++++---- ConsoleApp/CoreModule.cs | 13 +- ConsoleApp/Maps/Direction.cs | 15 ++ ConsoleApp/Maps/Heading.cs | 38 +++++ ConsoleApp/Maps/HexCell.cs | 2 +- ConsoleApp/Maps/ICell.cs | 7 + ConsoleApp/Maps/IMap.cs | 9 ++ ConsoleApp/Maps/IMapManager.cs | 7 + ConsoleApp/Maps/ISquareCell.cs | 5 +- ConsoleApp/Maps/MapFactory.cs | 2 +- ConsoleApp/Maps/MapManager.cs | 6 + ConsoleApp/Maps/SquareCell.cs | 11 +- ConsoleApp/Maps/SquareMap.cs | 34 ++++- ConsoleApp/Module.cs | 21 --- ConsoleApp/Program.cs | 10 +- ConsoleApp/UserConsole.cs | 19 ++- RobotIntelFinal.sln.DotSettings.user | 3 + 18 files changed, 268 insertions(+), 77 deletions(-) create mode 100644 ConsoleApp/Maps/Direction.cs create mode 100644 ConsoleApp/Maps/Heading.cs create mode 100644 ConsoleApp/Maps/ICell.cs create mode 100644 ConsoleApp/Maps/IMap.cs create mode 100644 ConsoleApp/Maps/IMapManager.cs create mode 100644 ConsoleApp/Maps/MapManager.cs delete mode 100644 ConsoleApp/Module.cs create mode 100644 RobotIntelFinal.sln.DotSettings.user 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 @@ - - - - - - - - - - - - - + + + + + - + @@ -86,8 +78,11 @@