/// <summary>
 /// Initializes a new instance of the <see cref="FriendlyBoard"/> class.
 /// </summary>
 public FriendlyBoard()
 {
     Pieces    = new FriendlyPiecesList();
     Attacks   = new FriendlyAttacksList();
     Castling  = new FriendlyCastling();
     EnPassant = new FriendlyEnPassant();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FriendlyBoard"/> class.
 /// </summary>
 /// <param name="bitboard">The bitboard.</param>
 public FriendlyBoard(Bitboard bitboard)
 {
     Pieces    = new FriendlyPiecesList(bitboard.Pieces);
     Attacks   = new FriendlyAttacksList(bitboard.Attacks, Pieces);
     Castling  = new FriendlyCastling(bitboard.CastlingPossibility, bitboard.CastlingDone);
     EnPassant = new FriendlyEnPassant(bitboard.EnPassant);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="FriendlyAttacksList"/> class.
        /// </summary>
        /// <param name="attacks">The array of attack bitboards (where index means field index (source piece position),
        ///                       and set bits are the destination attack positions.</param>
        /// <param name="pieces">The list of pieces.</param>
        public FriendlyAttacksList(ulong[] attacks, FriendlyPiecesList pieces)
        {
            for (var i = 0; i < 64; i++)
            {
                var fieldAttackers = attacks[i];
                var targetPosition = BitPositionConverter.ToPosition(i);

                while (fieldAttackers != 0)
                {
                    var attackerLSB = BitOperations.GetLSB(fieldAttackers);
                    fieldAttackers = BitOperations.PopLSB(fieldAttackers);

                    var attackerIndex    = BitOperations.GetBitIndex(attackerLSB);
                    var attackerPosition = BitPositionConverter.ToPosition(attackerIndex);
                    var attackerColor    = pieces.First(p => p.Position == attackerPosition).Color;

                    Add(new FriendlyAttack(attackerColor, attackerPosition, targetPosition));
                }
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="FriendlyBoard"/> class.
 /// </summary>
 /// <param name="pieces">The pieces list.</param>
 /// <param name="castling">The castling data.</param>
 /// <param name="enPassant">The en passant data.</param>
 public FriendlyBoard(FriendlyPiecesList pieces, FriendlyCastling castling, FriendlyEnPassant enPassant)
 {
     Pieces    = pieces;
     Castling  = castling;
     EnPassant = enPassant;
 }