Hex is done and working
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ConsoleApp.Maps
|
||||
{
|
||||
public interface IMineMap
|
||||
@@ -6,5 +8,6 @@ namespace ConsoleApp.Maps
|
||||
|
||||
int TotalBombs { get; }
|
||||
bool GetCell(int x, int y);
|
||||
List<Cell> PlacedMines { get; }
|
||||
}
|
||||
}
|
||||
@@ -12,23 +12,19 @@ namespace ConsoleApp.Maps
|
||||
private int _y;
|
||||
public bool[,] Map { get; }
|
||||
public int TotalBombs { get; }
|
||||
private List<Cell> _placedMines;
|
||||
public List<Cell> PlacedMines { get; }
|
||||
|
||||
public MineMap(int x, int y, double minePercentage)
|
||||
{
|
||||
_x = x;
|
||||
_y = y;
|
||||
_placedMines = new List<Cell>();
|
||||
PlacedMines = new List<Cell>();
|
||||
_mineCount = (int)(x*y*(minePercentage/100));
|
||||
TotalBombs = _mineCount;
|
||||
Map = new bool[x, y];
|
||||
Map.Fill2DArray(false);
|
||||
PlaceMines();
|
||||
using(TextWriter tw = new StreamWriter("/Users/brady.bodily/Documents/Repositories/CS5890_Robot_Intelligence/RobotIntelFinal/ConsoleApp/Output/Mines.txt"))
|
||||
{
|
||||
foreach (var s in _placedMines)
|
||||
tw.WriteLine($"{s.X} {s.Y}");
|
||||
}
|
||||
|
||||
}
|
||||
public bool GetCell(int x, int y) => Map[x,y];
|
||||
|
||||
@@ -47,7 +43,7 @@ namespace ConsoleApp.Maps
|
||||
else
|
||||
{
|
||||
Map[x, y] = true;
|
||||
_placedMines.Add(new Cell(x,y));
|
||||
PlacedMines.Add(new Cell(x,y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user