public LightTile[,] CreateGrid() { int distance = 10; int startXY = 5; for (int row = 0; row < this.grid.GetLength(0); row++) { for (int col = 0; col < this.grid.GetLength(1); col++) { LightTile tempTile = new LightTile(this.onTileColor, this.offTileColor); tempTile.Top = startXY + (row * this.buttonSize + distance); tempTile.Left = startXY + (col * this.buttonSize + distance); tempTile.Height = this.buttonSize; tempTile.Width = this.buttonSize; this.grid[row, col] = tempTile; } } return this.grid; }
public void AddNeighbour(LightTile tile) { this.Neighbours.Add(tile); }
private static void CreatePattern(LightTile[,] grid, Random rand) { int number; for (int row = 0; row < grid.GetLength(0) * 2; row++) { for (int col = 0; col < grid.GetLength(1) * 2; col++) { number = rand.Next(0, 200); if (number % 5 == 0) grid[row % grid.GetLength(0), col % grid.GetLength(1)] .SwitchLight(); } } }