public Grid(int x, int y) { int Id = 0; for (int i = 0; i < y; i++) { var r = new Row(); for (int a = 0; a < x; a++) { var c = new Cell(); c.Top = NullCell.Instance; c.Bottom = NullCell.Instance; c.Left = NullCell.Instance; c.Right = NullCell.Instance; if (i > 0) { c.Top = Rows[i - 1].Cells[a] ; Rows[i - 1].Cells[a].Bottom = c; } if (a > 0) { c.Left = (r.Cells[a - 1]); r.Cells[a - 1].Right = c; } c.Id = Id; r.Cells.Add(c); Id++; } Rows.Add(r); } }
public CellButton(Cell cell, WooAlgorithms.DynamicConnectivity.Percolation p) { this.percolator = p; this.cell = cell; base.Click += CellButton_Click; }