Example #1
0
        public bool isAt(int row, int col)
        {
            int inner_row = ToInnerRow(row);
            int inner_col = ToInnerCol(col);

            return(inner_row >= 0 &&
                   inner_row < tetromino.Rows() &&
                   inner_col >= 0 &&
                   inner_col < tetromino.Columns() &&
                   tetromino.CellAt(inner_row, inner_col) != Board.EMPTY);
        }
Example #2
0
        public void Drop(Tetromino drop)
        {
            CheckIfFalling();
            int r = StartingRowOffset(drop);

            fallingBlock = new MovableGrid(drop, this).MoveTo(r, Columns() / 2 - drop.Columns() / 2);
        }
Example #3
0
        public void Drop(Tetromino shape)
        {
            checkIfAlreadyFalling();
            int row = StartingRowOffset(shape);

            fallingBlock = new MovableGrid(shape).MoveTo(row, Cols / 2 - shape.Columns() / 2);
        }
Example #4
0
        public void Drop(Tetromino shape)
        {
            CheckIsFalling();
            int r = StartingRowOffset(shape);

            fallingBlock = new MovableGrid(shape).MoveTo(r, Columns / 2 - shape.Columns() / 2);
        }
Example #5
0
        public void Drop(Tetromino tetromino)
        {
            CheckIfFalling();
            int         row = StartingRowOffset(tetromino);
            MovableGrid mg  = new MovableGrid(tetromino);

            this.fallingBlock = mg.MoveTo(row, (this.columns / 2) - (tetromino.Columns() / 2));
        }
Example #6
0
 public Block(Tetromino grid)
 {
     this.rows    = grid.Rows();
     this.columns = grid.Columns();
     this.block   = new char[this.rows, this.columns];
     for (int row = 0; row < this.rows; row++)
     {
         for (int col = 0; col < this.columns; col++)
         {
             this.block[row, col] = grid.cellule(row, col);
         }
     }
 }
Example #7
0
 public int Columns()
 {
     return(inner.Columns());
 }