mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Simplify make_promotions()
Remove special case handling of QUIET_CHECKS in make_promotions() STC https://tests.stockfishchess.org/tests/view/5f055dbb59f6f035328945fb LLR: 2.98 (-2.94,2.94) {-1.50,0.50} Total: 42808 W: 8177 L: 8054 D: 26577 Ptnml(0-2): 665, 4890, 10201, 4953, 695 LTC https://tests.stockfishchess.org/tests/view/5f06231a59f6f03532894661 LLR: 2.96 (-2.94,2.94) {-1.50,0.50} Total: 9616 W: 1214 L: 1111 D: 7291 Ptnml(0-2): 53, 821, 2965, 908, 61 closes https://github.com/official-stockfish/Stockfish/pull/2800 Bench: 4576410
This commit is contained in:
parent
804a29c738
commit
bf5ce1c214
2 changed files with 12 additions and 14 deletions
|
@ -29,22 +29,20 @@ namespace {
|
||||||
ExtMove* make_promotions(ExtMove* moveList, Square to, Square ksq) {
|
ExtMove* make_promotions(ExtMove* moveList, Square to, Square ksq) {
|
||||||
|
|
||||||
if (Type == CAPTURES || Type == EVASIONS || Type == NON_EVASIONS)
|
if (Type == CAPTURES || Type == EVASIONS || Type == NON_EVASIONS)
|
||||||
|
{
|
||||||
*moveList++ = make<PROMOTION>(to - D, to, QUEEN);
|
*moveList++ = make<PROMOTION>(to - D, to, QUEEN);
|
||||||
|
if (attacks_bb<KNIGHT>(to) & ksq)
|
||||||
|
*moveList++ = make<PROMOTION>(to - D, to, KNIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
if (Type == QUIETS || Type == EVASIONS || Type == NON_EVASIONS)
|
if (Type == QUIETS || Type == EVASIONS || Type == NON_EVASIONS)
|
||||||
{
|
{
|
||||||
*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);
|
||||||
|
if (!(attacks_bb<KNIGHT>(to) & ksq))
|
||||||
*moveList++ = make<PROMOTION>(to - D, to, KNIGHT);
|
*moveList++ = make<PROMOTION>(to - D, to, KNIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Knight promotion is the only promotion that can give a direct check
|
|
||||||
// that's not already included in the queen promotion.
|
|
||||||
if (Type == QUIET_CHECKS && (attacks_bb<KNIGHT>(to) & ksq))
|
|
||||||
*moveList++ = make<PROMOTION>(to - D, to, KNIGHT);
|
|
||||||
else
|
|
||||||
(void)ksq; // Silence a warning under MSVC
|
|
||||||
|
|
||||||
return moveList;
|
return moveList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,8 +261,8 @@ namespace {
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
||||||
/// <CAPTURES> Generates all pseudo-legal captures and queen promotions
|
/// <CAPTURES> Generates all pseudo-legal captures plus queen and checking knight promotions
|
||||||
/// <QUIETS> Generates all pseudo-legal non-captures and underpromotions
|
/// <QUIETS> Generates all pseudo-legal non-captures and underpromotions(except checking knight)
|
||||||
/// <NON_EVASIONS> Generates all pseudo-legal captures and non-captures
|
/// <NON_EVASIONS> Generates all pseudo-legal captures and non-captures
|
||||||
///
|
///
|
||||||
/// Returns a pointer to the end of the move list.
|
/// Returns a pointer to the end of the move list.
|
||||||
|
@ -287,8 +285,8 @@ template ExtMove* generate<QUIETS>(const Position&, ExtMove*);
|
||||||
template ExtMove* generate<NON_EVASIONS>(const Position&, ExtMove*);
|
template ExtMove* generate<NON_EVASIONS>(const Position&, ExtMove*);
|
||||||
|
|
||||||
|
|
||||||
/// generate<QUIET_CHECKS> generates all pseudo-legal non-captures and knight
|
/// generate<QUIET_CHECKS> generates all pseudo-legal non-captures.
|
||||||
/// underpromotions that give check. Returns a pointer to the end of the move list.
|
/// Returns a pointer to the end of the move list.
|
||||||
template<>
|
template<>
|
||||||
ExtMove* generate<QUIET_CHECKS>(const Position& pos, ExtMove* moveList) {
|
ExtMove* generate<QUIET_CHECKS>(const Position& pos, ExtMove* moveList) {
|
||||||
|
|
||||||
|
|
|
@ -1486,8 +1486,8 @@ moves_loop: // When in check, search starts from here
|
||||||
|
|
||||||
// Initialize a MovePicker object for the current position, and prepare
|
// Initialize a MovePicker object for the current position, and prepare
|
||||||
// to search the moves. Because the depth is <= 0 here, only captures,
|
// to search the moves. Because the depth is <= 0 here, only captures,
|
||||||
// queen promotions and checks (only if depth >= DEPTH_QS_CHECKS) will
|
// queen and checking knight promotions, and other checks(only if depth >= DEPTH_QS_CHECKS)
|
||||||
// be generated.
|
// will be generated.
|
||||||
MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory,
|
MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory,
|
||||||
&thisThread->captureHistory,
|
&thisThread->captureHistory,
|
||||||
contHist,
|
contHist,
|
||||||
|
|
Loading…
Add table
Reference in a new issue