Ejemplo n.º 1
0
        private void ShiftColumn(int column, int shift)
        {
            for (int row = _field.Size - 1; row >= 0; row--)
            {
                var bubble = _field[row, column];
                if (bubble == null)
                {
                    return;
                }

                _field.Move(bubble, row, column + shift);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Shifts the column.
        /// </summary>
        /// <param name="field">The field.</param>
        /// <param name="column">The column.</param>
        private void ShiftColumn(BubbleField field, int column)
        {
            var shiftCounter = 0;

            for (var row = field.Size - 1; row >= 0; row--)
            {
                var bubble = field[row, column];
                if (bubble == null)
                {
                    shiftCounter++;
                }
                else if (shiftCounter > 0)
                {
                    field.Move(bubble, row + shiftCounter, column);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Shifts the row.
        /// </summary>
        /// <param name="field">The field.</param>
        /// <param name="row">The row.</param>
        private void ShiftRow(BubbleField field, int row)
        {
            var shiftCounter = 0;

            for (int column = field.Size - 1; column >= 0; column--)
            {
                var bubble = field[row, column];
                if (bubble == null)
                {
                    shiftCounter++;
                }
                else if (shiftCounter > 0)
                {
                    field.Move(bubble, row, column + shiftCounter);
                }
            }
        }