Skip to content

Commit c89274d

Browse files
committed
Merge branch 'master' into increase_iid
2 parents 81e9cf0 + f263881 commit c89274d

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

src/evaluate.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ namespace {
4040
Pawns::Entry* pi;
4141

4242
// attackedBy[color][piece type] is a bitboard representing all squares
43-
// attacked by a given color and piece type, attackedBy[color][0] contains
44-
// all squares attacked by the given color.
43+
// attacked by a given color and piece type, attackedBy[color][ALL_PIECES]
44+
// contains all squares attacked by the given color.
4545
Bitboard attackedBy[COLOR_NB][PIECE_TYPE_NB];
4646

4747
// kingRing[color] is the zone around the king which is considered
@@ -693,15 +693,15 @@ Value do_evaluate(const Position& pos, Value& margin) {
693693
// Undefended minors get penalized even if not under attack
694694
undefendedMinors = pos.pieces(Them)
695695
& (pos.pieces(BISHOP) | pos.pieces(KNIGHT))
696-
& ~ei.attackedBy[Them][0];
696+
& ~ei.attackedBy[Them][ALL_PIECES];
697697

698698
if (undefendedMinors)
699699
score += UndefendedMinorPenalty;
700700

701701
// Enemy pieces not defended by a pawn and under our attack
702702
weakEnemies = pos.pieces(Them)
703703
& ~ei.attackedBy[Them][PAWN]
704-
& ei.attackedBy[Us][0];
704+
& ei.attackedBy[Us][ALL_PIECES];
705705

706706
if (!weakEnemies)
707707
return score;
@@ -740,9 +740,9 @@ Value do_evaluate(const Position& pos, Value& margin) {
740740
score += evaluate_pieces<QUEEN, Us, Trace>(pos, ei, mobility, mobilityArea);
741741

742742
// Sum up all attacked squares
743-
ei.attackedBy[Us][0] = ei.attackedBy[Us][PAWN] | ei.attackedBy[Us][KNIGHT]
744-
| ei.attackedBy[Us][BISHOP] | ei.attackedBy[Us][ROOK]
745-
| ei.attackedBy[Us][QUEEN] | ei.attackedBy[Us][KING];
743+
ei.attackedBy[Us][ALL_PIECES] = ei.attackedBy[Us][PAWN] | ei.attackedBy[Us][KNIGHT]
744+
| ei.attackedBy[Us][BISHOP] | ei.attackedBy[Us][ROOK]
745+
| ei.attackedBy[Us][QUEEN] | ei.attackedBy[Us][KING];
746746
return score;
747747
}
748748

@@ -768,7 +768,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
768768
{
769769
// Find the attacked squares around the king which has no defenders
770770
// apart from the king itself
771-
undefended = ei.attackedBy[Them][0] & ei.attackedBy[Us][KING];
771+
undefended = ei.attackedBy[Them][ALL_PIECES] & ei.attackedBy[Us][KING];
772772
undefended &= ~( ei.attackedBy[Us][PAWN] | ei.attackedBy[Us][KNIGHT]
773773
| ei.attackedBy[Us][BISHOP] | ei.attackedBy[Us][ROOK]
774774
| ei.attackedBy[Us][QUEEN]);
@@ -816,7 +816,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
816816
}
817817

818818
// Analyse enemy's safe distance checks for sliders and knights
819-
safe = ~(pos.pieces(Them) | ei.attackedBy[Us][0]);
819+
safe = ~(pos.pieces(Them) | ei.attackedBy[Us][ALL_PIECES]);
820820

821821
b1 = pos.attacks_from<ROOK>(ksq) & safe;
822822
b2 = pos.attacks_from<BISHOP>(ksq) & safe;
@@ -903,7 +903,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
903903
if (pos.is_empty(blockSq))
904904
{
905905
squaresToQueen = forward_bb(Us, s);
906-
defendedSquares = squaresToQueen & ei.attackedBy[Us][0];
906+
defendedSquares = squaresToQueen & ei.attackedBy[Us][ALL_PIECES];
907907

908908
// If there is an enemy rook or queen attacking the pawn from behind,
909909
// add all X-ray attacks by the rook or queen. Otherwise consider only
@@ -912,7 +912,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
912912
&& (forward_bb(Them, s) & pos.pieces(Them, ROOK, QUEEN) & pos.attacks_from<ROOK>(s)))
913913
unsafeSquares = squaresToQueen;
914914
else
915-
unsafeSquares = squaresToQueen & (ei.attackedBy[Them][0] | pos.pieces(Them));
915+
unsafeSquares = squaresToQueen & (ei.attackedBy[Them][ALL_PIECES] | pos.pieces(Them));
916916

917917
// If there aren't enemy attacks or pieces along the path to queen give
918918
// huge bonus. Even bigger if we protect the pawn's path.
@@ -989,7 +989,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
989989
// Compute plies to queening and check direct advancement
990990
movesToGo = rank_distance(s, queeningSquare) - int(relative_rank(c, s) == RANK_2);
991991
oppMovesToGo = square_distance(pos.king_square(~c), queeningSquare) - int(c != pos.side_to_move());
992-
pathDefended = ((ei.attackedBy[c][0] & queeningPath) == queeningPath);
992+
pathDefended = ((ei.attackedBy[c][ALL_PIECES] & queeningPath) == queeningPath);
993993

994994
if (movesToGo >= oppMovesToGo && !pathDefended)
995995
continue;
@@ -1136,7 +1136,7 @@ Value do_evaluate(const Position& pos, Value& margin) {
11361136
Bitboard safe = SpaceMask[Us]
11371137
& ~pos.pieces(Us, PAWN)
11381138
& ~ei.attackedBy[Them][PAWN]
1139-
& (ei.attackedBy[Us][0] | ~ei.attackedBy[Them][0]);
1139+
& (ei.attackedBy[Us][ALL_PIECES] | ~ei.attackedBy[Them][ALL_PIECES]);
11401140

11411141
// Find all squares which are at most three squares behind some friendly pawn
11421142
Bitboard behind = pos.pieces(Us, PAWN);

src/search.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,8 @@ namespace {
856856
&& !captureOrPromotion
857857
&& !inCheck
858858
&& !dangerous
859-
&& move != ttMove)
859+
&& move != ttMove
860+
&& bestValue > VALUE_MATED_IN_MAX_PLY)
860861
{
861862
// Move count based pruning
862863
if ( depth < 16 * ONE_PLY
@@ -878,9 +879,14 @@ namespace {
878879

879880
if (futilityValue < beta)
880881
{
882+
bestValue = std::max(bestValue, futilityValue);
883+
881884
if (SpNode)
885+
{
882886
splitPoint->mutex.lock();
883-
887+
if (bestValue > splitPoint->bestValue)
888+
splitPoint->bestValue = bestValue;
889+
}
884890
continue;
885891
}
886892

src/ucioption.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ void init(OptionsMap& o) {
7070
o["Passed Pawns (Middle Game)"] = Option(100, 0, 200, on_eval);
7171
o["Passed Pawns (Endgame)"] = Option(100, 0, 200, on_eval);
7272
o["Space"] = Option(100, 0, 200, on_eval);
73-
o["Min Split Depth"] = Option(msd, 4, 7, on_threads);
73+
o["Min Split Depth"] = Option(msd, 4, 12, on_threads);
7474
o["Max Threads per Split Point"] = Option(5, 4, 8, on_threads);
7575
o["Threads"] = Option(cpus, 1, MAX_THREADS, on_threads);
7676
o["Use Sleeping Threads"] = Option(true);

0 commit comments

Comments
 (0)