Beispiel #1
0
        public MoveWrapper(int move)
        {
            Move = move;

            FromIndex = MoveUtil.GetFromIndex(move);
            FromFile  = (char)(104 - FromIndex % 8);
            FromRank  = FromIndex / 8 + 1;

            ToIndex = MoveUtil.GetToIndex(move);
            ToFile  = (char)(104 - ToIndex % 8);
            ToRank  = ToIndex / 8 + 1;

            PieceIndex         = MoveUtil.GetSourcePieceIndex(move);
            PieceIndexAttacked = MoveUtil.GetAttackedPieceIndex(move);

            switch (MoveUtil.GetMoveType(move))
            {
            case MoveUtil.TypeNormal:
                break;

            case MoveUtil.TypeCastling:
                IsCastling = true;
                break;

            case MoveUtil.TypeEp:
                IsEp = true;
                break;

            case MoveUtil.TypePromotionB:
                IsBishopPromotion = true;
                break;

            case MoveUtil.TypePromotionN:
                IsKnightPromotion = true;
                break;

            case MoveUtil.TypePromotionQ:
                IsQueenPromotion = true;
                break;

            case MoveUtil.TypePromotionR:
                IsRookPromotion = true;
                break;

            default:
                throw new ArgumentException("Unknown movetype: " + MoveUtil.GetMoveType(move));
            }
        }