Exemplo n.º 1
0
 public void test()
 {
     if (Length == Cells.Length)
     {
         System.Drawing.Color c = Tetromino.PickColor();
         foreach (SudokuCell cell in Cells)
         {
             cell.BackColor = c;
         }
     }
 }
Exemplo n.º 2
0
 /// <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;
     }
 }
Exemplo n.º 3
0
        /// <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);
        }
Exemplo n.º 4
0
        /// <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);
                    }
                }
            }
        }