Beispiel #1
0
        /// <summary>
        /// Constructor for pawn promotions moves
        /// </summary>
        public Move(int from_cell, int to_cell, Flags flags, Exports.Pieces promote_to)
        {
            Debug.Assert(flags.HasFlag(Flags.Promotion));
            Debug.Assert(!(flags.HasFlag(Flags.EnPassantCapture)
                || flags.HasFlag(Flags.ShortCastle) || flags.HasFlag(Flags.LongCastle)));
            Debug.Assert(promote_to == Exports.Pieces.Knight
                || promote_to == Exports.Pieces.Bishop
                || promote_to == Exports.Pieces.Rook
                || promote_to == Exports.Pieces.Queen);

            m_data = new Bitmask32();
            Init((int)Exports.Pieces.Pawn, from_cell, to_cell, (int)flags,
                (int)promote_to);
        }
Beispiel #2
0
        public Move(Exports.Pieces piece, int from_cell, int to_cell, uint cell_index,
            Flags flags)
        {
            // If castle flag is set, then this must be a king's move
            Debug.Assert(
                !((flags.HasFlag(Flags.ShortCastle) || flags.HasFlag(Flags.LongCastle))
                && piece != Exports.Pieces.King));
            // Must use another consructor for pawn promotions
            Debug.Assert(!flags.HasFlag(Flags.Promotion));
            // EnPassantCapture implies Capture
            Debug.Assert(!flags.HasFlag(Flags.EnPassantCapture)
                || flags.HasFlag(Flags.Capture));

            m_data = new Bitmask32();
            Init((int)piece, from_cell, to_cell, (int)flags, 0);
        }