示例#1
0
        /// <summary>
        /// オブジェクトの等値性を判定します。
        /// </summary>
        public bool BoardEquals(Board other)
        {
            if ((object)other == null)
            {
                return(false);
            }

            using (LazyLock())
                using (other.LazyLock())
                {
                    for (var rank = 1; rank < BoardSize; ++rank)
                    {
                        for (var file = 1; file < BoardSize; ++file)
                        {
                            var square = new Square(file, rank);

                            if (this[square] != other[square])
                            {
                                return(false);
                            }
                        }
                    }

                    if (!this.blackCapturedPieceBox.Equals(other.blackCapturedPieceBox) ||
                        !this.whiteCapturedPieceBox.Equals(other.whiteCapturedPieceBox))
                    {
                        return(false);
                    }

                    if (this.turn != other.turn)
                    {
                        return(false);
                    }

                    /*if (this.prevMovedSquare != other.prevMovedSquare)
                     * {
                     *  return false;
                     * }*/

                    //private List<BoardMove> moveList = new List<BoardMove>();
                    return(true);
                }
        }
示例#2
0
        /// <summary>
        /// オブジェクトの等値性を判定します。
        /// </summary>
        public bool BoardEquals(Board other)
        {
            if ((object)other == null)
            {
                return false;
            }

            using (LazyLock())
            using (other.LazyLock())
            {
                for (var rank = 1; rank < BoardSize; ++rank)
                {
                    for (var file = 1; file < BoardSize; ++file)
                    {
                        var square = new Square(file, rank);

                        if (this[square] != other[square])
                        {
                            return false;
                        }
                    }
                }

                if (!this.blackCapturedPieceBox.Equals(other.blackCapturedPieceBox) ||
                    !this.whiteCapturedPieceBox.Equals(other.whiteCapturedPieceBox))
                {
                    return false;
                }

                if (this.turn != other.turn)
                {
                    return false;
                }

                /*if (this.prevMovedSquare != other.prevMovedSquare)
                {
                    return false;
                }*/

                //private List<BoardMove> moveList = new List<BoardMove>();
                return true;
            }
        }