Files
robot_intelligence_final_pr…/ConsoleApp/Maps/HexMap.cs
Brady Bodily d63066c150 Backup
Working through some localization stuff will probably be pretty fluid.
2020-12-14 16:08:59 -07:00

43 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
namespace ConsoleApp.Maps
{
public class HexMap : IHexMap
{
public Cell[,] Map { get; }
public ICell StartingCell { get; }
public ICell LastCell { get; }
/// <summary>
/// Generate Hex map with cells of 25cm X 25cm
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
public HexMap(int x, int y)
{
//convert to cm
x *= 100;
y *= 100;
//calculate number of cells on x and y axis
var xCellCount = (int)Math.Ceiling((decimal) (x) / 25);
var yCellCount = (int)Math.Ceiling((decimal) (y) / 25);
//set last cell;
StartingCell = Map[0, 0];
Map = new Cell[xCellCount, yCellCount];
for (int r = 0; r < yCellCount; r++) {
int r_offset = Convert.ToInt32(Math.Floor(Convert.ToDouble(r)/2));
for (int q = r_offset; q < xCellCount - r_offset; q++) {
// Console.WriteLine($"r:{r}, q:{q}-----x:{x}, y:{y}");
Map[r, q] = new Cell(q, r, -q-r);
}
}
}
public List<ICell> PossibleMoves(ICell currentCell)
{
throw new NotImplementedException();
}
}
}