/// <summary>
        /// Internal implementation for setting a cell's value.
        /// </summary>
        private static bool TrySetCellInternal(byte[] boardData, int zeroBasedRowIndex, int zeroBasedColumnIndex, byte value)
        {
            Board.BoardDataContract(boardData);
            Board.IndexValidContract(zeroBasedRowIndex);
            Board.IndexValidContract(zeroBasedColumnIndex);
            Board.CellValueContract(value, allowZero: false);

            if (Board.IsValuePossible(boardData, zeroBasedRowIndex, zeroBasedColumnIndex, value))
            {
                boardData[Board.CalculateIndexFromRowAndColumn(zeroBasedRowIndex, zeroBasedColumnIndex)] = value;
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Resets a cell's value to unset.
        /// </summary>
        /// <param name="zeroBasedRowIndex">Index of the row.</param>
        /// <param name="zeroBasedColumnIndex">Index of the column.</param>
        public void ResetCell(int zeroBasedRowIndex, int zeroBasedColumnIndex)
        {
            ContractExtensions.IsNotDisposed(this, this.IsDisposed);
            ContractExtensions.IsValidIndex(zeroBasedRowIndex, "zeroBasedRowIndex");
            ContractExtensions.IsValidIndex(zeroBasedColumnIndex, "zeroBasedColumnIndex");
            Contract.EndContractBlock();

            this.contentLock.EnterWriteLock();
            try
            {
                this.content[Board.CalculateIndexFromRowAndColumn(zeroBasedRowIndex, zeroBasedColumnIndex)] = 0;
            }
            finally
            {
                this.contentLock.ExitWriteLock();
            }
        }
        /// <summary>
        /// Gets the value of a cell.
        /// </summary>
        /// <param name="zeroBasedRowIndex">Index of the row.</param>
        /// <param name="zeroBasedColumnIndex">Index of the column.</param>
        /// <returns>Value of the cell at the specified row and column index.</returns>
        /// <remarks>
        /// Zero is returned for an unset cell.
        /// </remarks>
        public byte GetCell(int zeroBasedRowIndex, int zeroBasedColumnIndex)
        {
            ContractExtensions.IsNotDisposed(this, this.IsDisposed);
            ContractExtensions.IsValidIndex(zeroBasedRowIndex, "zeroBasedRowIndex");
            ContractExtensions.IsValidIndex(zeroBasedColumnIndex, "zeroBasedColumnIndex");
            Contract.EndContractBlock();

            // Note that we use a read lock this time. This makes sure that many threads
            // can read the board's content at the same time.
            this.contentLock.EnterReadLock();
            try
            {
                return(this.content[Board.CalculateIndexFromRowAndColumn(zeroBasedRowIndex, zeroBasedColumnIndex)]);
            }
            finally
            {
                this.contentLock.ExitReadLock();
            }
        }