The Beauty of Bitboards

I really am enjoying coding Maverick using bitboards.  Yesterday I stumbled across a neat way to handle en-passant move generation.

moves = (((board->piecelist[piece] << 7) >> 16 * to_move) & B8H1) & (board->occupied[opponent] | board->ep_square);

The term “board->ep_square” is a bitboard holding the en-passant target capture square.  The last “or” instruction fools the move generation routine into thinking there is piece at this target square.  This means en-passant moves are then handled the same as all other pawn captures (über-cool!!).