/*public struct NodeItem * { * public string Key; * public int Quantity; * * public NodeItem(string key, int quantity) * { * Key = key; * Quantity = quantity; * } * }*/ // ------------------------------------------- public static GrowingGrid <char> ReadGrowingGrid(string input, char lineseparator, char defaultValue) { var grid = ParseCharGrid(input, lineseparator); var xRange = new Point(0, grid.GetLength(0)); var yRange = new Point(0, grid.GetLength(1)); var growingGrid = new GrowingGrid <char>(defaultValue, xRange, yRange, grid.Length, true, true); growingGrid.AddGrid(0, 0, grid, GridAxes.XY); return(growingGrid); }
public void OffsetedAddGrid() { var grid = new GrowingGrid <int>(0, new Point(0, 2), new Point(0, 5), 10, true, true); grid.AddGrid(1, 1, SmallSquare, GridAxes.YX); Assert.Equal(1, grid[1, 1]); Assert.Equal(2, grid[2, 1]); Assert.Equal(3, grid[2, 2]); Assert.Equal(4, grid[1, 2]); }
public void SimpleAddGrid() { var grid = new GrowingGrid <int>(0, new Point(0, 2), new Point(0, 5), 10, true, true); var gridToAdd = new int[, ] { { 1, 0, 2 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 4, 0, 3 } }; grid.AddGrid(0, 0, gridToAdd, GridAxes.YX); Assert.Equal(1, grid[0, 0]); Assert.Equal(2, grid[2, 0]); Assert.Equal(3, grid[2, 5]); Assert.Equal(4, grid[0, 5]); }