예제 #1
0
파일: Board.cs 프로젝트: sam25/Tetris
        /// <summary>
        /// Returns true if the current block is allowed to make its next move else false
        /// </summary>
        /// <param name="ablock"></param>
        /// <returns></returns>
        private bool canBeThere(Block ablock)
        {
            bool isMoveable = true;
            int dim = 4;

            for (int row = 0; row < dim; row++)
            {
                for (int col = 0; col < dim; col++)
                {
                    if (ablock.currBlock[row, col])
                    {
                        Coordinate c = ablock.toBoardCoord(new Coordinate(col, row));
                        if (isOccupiedCell(c) || c.x >= numCols || c.x < 0 || c.y >= numRows)
                            isMoveable = false;
                    }
                }
            }
            return isMoveable;
        }