1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 08:43:09 +00:00

Optimize order of a few conditions in search

Also fix size of KingDanger array to reduce memory footprint.

Small speed up of around 0.5%

No functional change.
This commit is contained in:
ajithcj 2016-08-31 05:51:52 +00:00 committed by Marco Costalba
parent 2731bbaf6b
commit 5cffc032da
2 changed files with 5 additions and 5 deletions

View file

@ -210,7 +210,7 @@ namespace {
// in KingDanger[]. Various little "meta-bonuses" measuring the strength // in KingDanger[]. Various little "meta-bonuses" measuring the strength
// of the enemy attack are added up into an integer, which is used as an // of the enemy attack are added up into an integer, which is used as an
// index to KingDanger[]. // index to KingDanger[].
Score KingDanger[512]; Score KingDanger[400];
// KingAttackWeights[PieceType] contains king attack weights by piece type // KingAttackWeights[PieceType] contains king attack weights by piece type
const int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 7, 5, 4, 1 }; const int KingAttackWeights[PIECE_TYPE_NB] = { 0, 0, 7, 5, 4, 1 };

View file

@ -725,8 +725,8 @@ namespace {
// Step 6. Razoring (skipped when in check) // Step 6. Razoring (skipped when in check)
if ( !PvNode if ( !PvNode
&& depth < 4 * ONE_PLY && depth < 4 * ONE_PLY
&& eval + razor_margin[depth / ONE_PLY] <= alpha && ttMove == MOVE_NONE
&& ttMove == MOVE_NONE) && eval + razor_margin[depth / ONE_PLY] <= alpha)
{ {
if ( depth <= ONE_PLY if ( depth <= ONE_PLY
&& eval + razor_margin[3 * ONE_PLY] <= alpha) && eval + razor_margin[3 * ONE_PLY] <= alpha)
@ -924,8 +924,8 @@ moves_loop: // When in check search starts from here
&& !captureOrPromotion && !captureOrPromotion
&& !inCheck && !inCheck
&& !givesCheck && !givesCheck
&& !pos.advanced_pawn_push(move) && bestValue > VALUE_MATED_IN_MAX_PLY
&& bestValue > VALUE_MATED_IN_MAX_PLY) && !pos.advanced_pawn_push(move))
{ {
// Move count based pruning // Move count based pruning
if (moveCountPruning) if (moveCountPruning)