예제 #1
0
        /// <summary>
        /// Set the empty cell position
        /// </summary>
        private void SetEmptyCellPosition()
        {
            Cell emptyCell = new Cell(
                MatrixSpecialValues.EmptyCellValue,
                new Position(this.Width - 1, this.Height - 1));

            this.Field[emptyCell.Position.Row, emptyCell.Position.Column] = emptyCell.Value;
        }
예제 #2
0
        /// <summary>
        /// Gets the target cell
        /// </summary>
        /// <returns>The target cell</returns>
        protected ICell GetTargetCell()
        {
            ICell targetCell = new Cell(MatrixSpecialValues.EmptyCellValue, new Position(0, 0));
            for (int row = 0; row < this.Width; row++)
            {
                for (int col = 0; col < this.Height; col++)
                {
                    if (this.Field[row, col] == MatrixSpecialValues.EmptyCellValue)
                    {
                        targetCell.Position.Row = row;
                        targetCell.Position.Column = col;

                        return targetCell;
                    }
                }
            }

            return targetCell;
        }