Esempio n. 1
0
        /// <summary>
        /// ハッシュコードを取得します。
        /// </summary>
        public override int GetHashCode()
        {
            // ValueType.GetHashCodeは遅いらしい。。。
            if (IsSpecialMove)
            {
                return(SpecialMoveType.GetHashCode());
            }
            else
            {
                var baseHashCode =
                    BWType.GetHashCode() ^
                    SameAsOld.GetHashCode() ^
                    RelFileType.GetHashCode() ^
                    RankMoveType.GetHashCode() ^
                    ActionType.GetHashCode() ^
                    (Piece != null ? Piece.GetHashCode() : 0) ^
                    (SrcSquare != null ? SrcSquare.GetHashCode() : 0);

                if (SameAsOld)
                {
                    return(baseHashCode);
                }
                else
                {
                    return(
                        baseHashCode ^
                        File.GetHashCode() ^
                        Rank.GetHashCode());
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 /// ハッシュ値を計算します。
 /// </summary>
 public override int GetHashCode()
 {
     return(
         BWType.GetHashCode() ^
         (DstSquare != null ? DstSquare.GetHashCode() : 0) ^
         (SrcSquare != null ? SrcSquare.GetHashCode() : 0) ^
         (MovePiece != null ? MovePiece.GetHashCode() : 0) ^
         DropPieceType.GetHashCode() ^
         IsPromote.GetHashCode() ^
         SpecialMoveType.GetHashCode());
 }