public void test() { if (Length == Cells.Length) { System.Drawing.Color c = Tetromino.PickColor(); foreach (SudokuCell cell in Cells) { cell.BackColor = c; } } }
/// <summary> /// Creates a Template based on a Tetromino from the Sudoku Board /// </summary> /// <param name="pTetro"></param> public TetroTemplate(Tetromino pTetro) { original = pTetro; Result = pTetro.Result; Mode = pTetro.Mode; CellCoord = new int[pTetro.Cells.Length, 2]; for (int i = 0; i < pTetro.Length; i++) { CellCoord[i, 0] = pTetro.Cells[i].Row; CellCoord[i, 1] = pTetro.Cells[i].Column; } }
/// <summary> /// Gets the corresponding Tetromino for a specific coordinate /// </summary> /// <param name="Row"></param> /// <param name="Col"></param> /// <returns></returns> public Tetromino GetTetroAt(int Row, int Col) { Tetromino foundTetro = null; foreach (Tetromino Tetro in Tetrominos) { if (Tetro.ContainsCellAt(Row, Col)) { foundTetro = Tetro; break; } } return(foundTetro); }
/// <summary> /// Adds a tetromino to the Sudoku layout, both logically and visually /// </summary> public void AddTetros() { Tetromino newTetro; Random r = new Random(); for (int Row = 0; Row < Dimension && !stopGenerator; Row++) { for (int Col = 0; Col < Dimension && !stopGenerator; Col++) { if (CellGrid[Row, Col].sTetro == null) { newTetro = new Tetromino(this, Row, Col); Tetrominos.Add(newTetro); System.Threading.Thread.Sleep(100); } } } }