mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Simplify promotion move generation
closes https://github.com/official-stockfish/Stockfish/pull/4892 No functional change
This commit is contained in:
parent
f17db4641e
commit
883163395e
1 changed files with 5 additions and 11 deletions
|
@ -31,18 +31,12 @@ namespace {
|
||||||
template<GenType Type, Direction D, bool Enemy>
|
template<GenType Type, Direction D, bool Enemy>
|
||||||
ExtMove* make_promotions(ExtMove* moveList, [[maybe_unused]] Square to) {
|
ExtMove* make_promotions(ExtMove* moveList, [[maybe_unused]] Square to) {
|
||||||
|
|
||||||
if constexpr (Type == CAPTURES || Type == EVASIONS || Type == NON_EVASIONS)
|
constexpr bool all = Type == EVASIONS || Type == NON_EVASIONS;
|
||||||
{
|
|
||||||
*moveList++ = make<PROMOTION>(to - D, to, QUEEN);
|
|
||||||
if constexpr (Enemy && Type == CAPTURES)
|
|
||||||
{
|
|
||||||
*moveList++ = make<PROMOTION>(to - D, to, ROOK);
|
|
||||||
*moveList++ = make<PROMOTION>(to - D, to, BISHOP);
|
|
||||||
*moveList++ = make<PROMOTION>(to - D, to, KNIGHT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if constexpr ((Type == QUIETS && !Enemy) || Type == EVASIONS || Type == NON_EVASIONS)
|
if constexpr (Type == CAPTURES || all)
|
||||||
|
*moveList++ = make<PROMOTION>(to - D, to, QUEEN);
|
||||||
|
|
||||||
|
if constexpr ((Type == CAPTURES && Enemy) || (Type == QUIETS && !Enemy) || all)
|
||||||
{
|
{
|
||||||
*moveList++ = make<PROMOTION>(to - D, to, ROOK);
|
*moveList++ = make<PROMOTION>(to - D, to, ROOK);
|
||||||
*moveList++ = make<PROMOTION>(to - D, to, BISHOP);
|
*moveList++ = make<PROMOTION>(to - D, to, BISHOP);
|
||||||
|
|
Loading…
Add table
Reference in a new issue