Пример #1
0
        /// <summary>
        /// Moves the piece
        /// </summary>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <returns>The cell of the newly opened position</returns>
        public PuzzleCell MovePiece(int row, int col)
        {
            Debug.Assert(GetMoveStatus(row, col) != MoveStatus.BadMove);

            PuzzleCell cell = new PuzzleCell(_emptyRow, _emptyCol, EMPTY_CELL_ID);

            short origCell = _cells[row, col];

            _cells[_emptyRow, _emptyCol] = origCell;
            _cells[row, col]             = EMPTY_CELL_ID;

            _emptyCol = col;
            _emptyRow = row;


            return(cell);
        }
Пример #2
0
        /// <summary>
        /// Moves the piece
        /// </summary>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <returns>The cell of the newly opened position</returns>
        public PuzzleCell MovePiece(int row, int col)
        {
            Debug.Assert(GetMoveStatus(row, col) != MoveStatus.BadMove);

            PuzzleCell cell = new PuzzleCell(_emptyRow, _emptyCol, EMPTY_CELL_ID);

            short origCell = _cells[row, col];

            _cells[_emptyRow, _emptyCol] = origCell;
            _cells[row, col] = EMPTY_CELL_ID;

            _emptyCol = col;
            _emptyRow = row;

            return cell;
        }