8-add-legal-move-filter #16
@@ -220,6 +220,9 @@ void gen_white_pawn_push_promotions(const struct Board *board, struct Move *out,
|
||||
int to = pop_lsb_index(&promos);
|
||||
int from = to - 8;
|
||||
push_move(out, count, from, to, P, Q, MF_PROMO);
|
||||
push_move(out, count, from, to, P, R, MF_PROMO);
|
||||
push_move(out, count, from, to, P, B, MF_PROMO);
|
||||
push_move(out, count, from, to, P, N, MF_PROMO);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,6 +238,9 @@ void gen_black_pawn_push_promotions(const struct Board *board, struct Move *out,
|
||||
int to = pop_lsb_index(&promos);
|
||||
int from = to + 8;
|
||||
push_move(out, count, from, to, p, q, MF_PROMO);
|
||||
push_move(out, count, from, to, p, r, MF_PROMO);
|
||||
push_move(out, count, from, to, p, b, MF_PROMO);
|
||||
push_move(out, count, from, to, p, n, MF_PROMO);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,6 +252,9 @@ void gen_white_pawn_capture_promotions(const struct Board *board, struct Move *o
|
||||
int to = pop_lsb_index(&left);
|
||||
int from = to - 7;
|
||||
push_move(out, count, from, to, P, Q, MF_CAPTURE | MF_PROMO);
|
||||
push_move(out, count, from, to, P, R, MF_CAPTURE | MF_PROMO);
|
||||
push_move(out, count, from, to, P, B, MF_CAPTURE | MF_PROMO);
|
||||
push_move(out, count, from, to, P, N, MF_CAPTURE | MF_PROMO);
|
||||
}
|
||||
// right capture: +9, mask off file H
|
||||
uint64_t right = ((board->pieces[P] & ~FILE_H) << 9) & opp & RANK_8;
|
||||
@@ -253,6 +262,9 @@ void gen_white_pawn_capture_promotions(const struct Board *board, struct Move *o
|
||||
int to = pop_lsb_index(&right);
|
||||
int from = to - 9;
|
||||
push_move(out, count, from, to, P, Q, MF_CAPTURE | MF_PROMO);
|
||||
push_move(out, count, from, to, P, R, MF_CAPTURE | MF_PROMO);
|
||||
push_move(out, count, from, to, P, B, MF_CAPTURE | MF_PROMO);
|
||||
push_move(out, count, from, to, P, N, MF_CAPTURE | MF_PROMO);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,6 +276,9 @@ void gen_black_pawn_capture_promotions(const struct Board *board, struct Move *o
|
||||
int to = pop_lsb_index(&left);
|
||||
int from = to + 7;
|
||||
push_move(out, count, from, to, p, q, MF_CAPTURE | MF_PROMO);
|
||||
push_move(out, count, from, to, p, r, MF_CAPTURE | MF_PROMO);
|
||||
push_move(out, count, from, to, p, b, MF_CAPTURE | MF_PROMO);
|
||||
push_move(out, count, from, to, p, n, MF_CAPTURE | MF_PROMO);
|
||||
}
|
||||
// “right” is -9 (mask off file A)
|
||||
uint64_t right = ((board->pieces[p] & ~FILE_A) >> 9) & opp & RANK_1;
|
||||
@@ -271,6 +286,9 @@ void gen_black_pawn_capture_promotions(const struct Board *board, struct Move *o
|
||||
int to = pop_lsb_index(&right);
|
||||
int from = to + 9;
|
||||
push_move(out, count, from, to, p, q, MF_CAPTURE | MF_PROMO);
|
||||
push_move(out, count, from, to, p, r, MF_CAPTURE | MF_PROMO);
|
||||
push_move(out, count, from, to, p, b, MF_CAPTURE | MF_PROMO);
|
||||
push_move(out, count, from, to, p, n, MF_CAPTURE | MF_PROMO);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user