public Map(int mapWidth, int mapHeight) { width = mapWidth; height = mapHeight; cellArray = new Cell[width, height]; for (int y = 0; y < width; y++) { for (int x = 0; x < height; x++) { cellArray[x, y] = new Cell(Cell.CellStates.FREE, x, y); } } }
//---- Manhattan distance calculators - helper function. public static int manhattanCellToPos(Cell c, Tuple<int, int> pos) { return Math.Abs(c.x - pos.Item1) + Math.Abs(c.y - pos.Item2); }