Example #1
0
        public static TriangleGrid CreateTriangleGrid(int size)
        {
            var width  = (2 * size) - 1;
            var height = size;

            if (size % 2 == 0)
            {
                height++;
            }

            var grid = new TriangleGrid(height, width);

            grid.Init();

            // Disable cells
            for (int row = 0; row < height; row++)
            {
                var end = height - 1 - row;

                for (int col = 0; col < end; col++)
                {
                    grid.SetCell(row, col, null);
                    grid.SetCell(row, width - col - 1, null);
                }
            }

            grid.ConfigureCells();

            return(grid);
        }
Example #2
0
        public static TriangleGrid CreateTriangleGrid(int rows, int columns)
        {
            var grid = new TriangleGrid(rows, columns);

            grid.Init();

            return(grid);
        }