nkarve / surge

A fast bitboard-based chess move generator in C++
MIT License
63 stars 15 forks source link

Missed pawn promotions in move generation algorithm #27

Open chrizator opened 1 year ago

chrizator commented 1 year ago

When the only checker is a knight on the 8th or 1st rank respectively, pawn captures are not considered promotions. You end up with a pawn on the 8th or 1st rank.


case make_piece(Them, KNIGHT):
    //If the checker is either a pawn or a knight, the only legal moves are to capture
    //the checker. Only non-pinned pieces can capture it
    b1 = attackers_from<Us>(checker_square, all) & not_pinned;
    while (b1) *list++ = Move(pop_lsb(&b1), checker_square, CAPTURE);

    return list;