Skip to content

Commit

Permalink
Take 2
Browse files Browse the repository at this point in the history
  • Loading branch information
ElbertoOne committed Sep 13, 2017
1 parent 0f79dbb commit 0937bf5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ namespace {
// Step 1. Initialize node
Thread* thisThread = pos.this_thread();
inCheck = pos.checkers();
ss->inCheck = inCheck;
moveCount = quietCount = ss->moveCount = 0;
ss->statScore = 0;
bestValue = -VALUE_INFINITE;
Expand Down Expand Up @@ -875,6 +876,12 @@ namespace {
&& !moveCountPruning
&& pos.see_ge(move))
extension = ONE_PLY;
else if ( (ss-1)->inCheck
&& !moveCountPruning
&& to_sq((ss-1)->currentMove) == pos.square<KING>(~pos.side_to_move())
&& pos.king_ring_attack(move)
&& pos.see_ge(move))
extension = ONE_PLY;

// Calculate new depth for this move
newDepth = depth - ONE_PLY + extension;
Expand All @@ -886,8 +893,9 @@ namespace {
{
if ( !captureOrPromotion
&& !givesCheck
&& ((!pos.advanced_pawn_push(move) && !(pos.captured_piece() && pos.king_ring_attack(move))) || pos.non_pawn_material() >= Value(5000)))
&& (!pos.advanced_pawn_push(move) || pos.non_pawn_material() >= Value(5000)))
{

// Move count based pruning
if (moveCountPruning)
{
Expand Down Expand Up @@ -1255,9 +1263,9 @@ namespace {
if ( !InCheck
&& !givesCheck
&& futilityBase > -VALUE_KNOWN_WIN
&& !pos.advanced_pawn_push(move)
&& !(pos.captured_piece() && pos.king_ring_attack(move)))
&& !pos.advanced_pawn_push(move))
{

assert(type_of(move) != ENPASSANT); // Due to !pos.advanced_pawn_push

futilityValue = futilityBase + PieceValue[EG][pos.piece_on(to_sq(move))];
Expand Down
1 change: 1 addition & 0 deletions src/search.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ struct Stack {
Value staticEval;
int statScore;
int moveCount;
bool inCheck;
};


Expand Down

0 comments on commit 0937bf5

Please sign in to comment.