Example #1
0
        public override string ToString()
        {
            StringBuilder sb     = new StringBuilder();
            string        fromSq = FromSq.GetLabel();
            string        toSq   = ToSq.GetLabel();

            sb.Append(fromSq + toSq);
            if (PromotedPiece.HasValue)
            {
                sb.Append(char.ToLower(Piece.GetLabelFromPieceIndex(PromotedPiece.Value)));
            }
            return(sb.ToString());
        }
Example #2
0
        public override int GetHashCode()
        {
            var hashCode = 1200616606;

            hashCode = hashCode * -1521134295 + Value.GetHashCode();
            hashCode = hashCode * -1521134295 + Score.GetHashCode();
            hashCode = hashCode * -1521134295 + FromSq.GetHashCode();
            hashCode = hashCode * -1521134295 + ToSq.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <int?> .Default.GetHashCode(CapturedPiece);

            hashCode = hashCode * -1521134295 + EqualityComparer <int?> .Default.GetHashCode(PromotedPiece);

            hashCode = hashCode * -1521134295 + IsEnPassant.GetHashCode();
            hashCode = hashCode * -1521134295 + IsPawnStart.GetHashCode();
            hashCode = hashCode * -1521134295 + IsCastle.GetHashCode();
            return(hashCode);
        }