X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=2a6ba30b8367e93a6d84869d31b2c7fa5ca01a4f;hp=88d3e8a0b02817d2fc7f07b0318ee6af63c6894c;hb=a3477af2a172066f760c52ddf7b674394dff364f;hpb=2dbc8feae32e923904a9d05ced4847fd8e6f6724 diff --git a/src/search.cpp b/src/search.cpp index 88d3e8a0..2a6ba30b 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -69,16 +69,16 @@ namespace { public: RootMoveList(Position &pos, Move searchMoves[]); - Move get_move(int moveNum) const; - Value get_move_score(int moveNum) const; - void set_move_score(int moveNum, Value score); - void set_move_nodes(int moveNum, int64_t nodes); + inline Move get_move(int moveNum) const; + inline Value get_move_score(int moveNum) const; + inline void set_move_score(int moveNum, Value score); + inline void set_move_nodes(int moveNum, int64_t nodes); void set_move_pv(int moveNum, const Move pv[]); - Move get_move_pv(int moveNum, int i) const; - int64_t get_move_cumulative_nodes(int moveNum) const; - int move_count() const; + inline Move get_move_pv(int moveNum, int i) const; + inline int64_t get_move_cumulative_nodes(int moveNum) const; + inline int move_count() const; Move scan_for_easy_move() const; - void sort(); + inline void sort(); void sort_multipv(int n); private: @@ -416,7 +416,7 @@ void think(const Position &pos, bool infinite, bool ponder, int side_to_move, int myTime = time[side_to_move]; int myIncrement = increment[side_to_move]; int oppTime = time[1 - side_to_move]; - + TimeAdvantage = myTime - oppTime; if(!movesToGo) { // Sudden death time control @@ -1122,9 +1122,7 @@ namespace { } } // Null move search not allowed, try razoring - else if ( depth < RazorDepth - && approximateEval < beta - RazorMargin - && evaluate(pos, ei, threadID) < beta - RazorMargin) + else if (depth < RazorDepth && approximateEval < beta - RazorMargin) { Value v = qsearch(pos, ss, beta-1, beta, Depth(0), ply, threadID); if (v < beta) @@ -1149,6 +1147,7 @@ namespace { Value value, bestValue = -VALUE_INFINITE; Bitboard dcCandidates = mp.discovered_check_candidates(); Value futilityValue = VALUE_NONE; + MovePicker::MovegenPhase moveType; bool isCheck = pos.is_check(); bool useFutilityPruning = UseFutilityPruning && depth < SelectiveDepth @@ -1157,14 +1156,14 @@ namespace { // Loop through all legal moves until no moves remain or a beta cutoff // occurs. while ( bestValue < beta - && (move = mp.get_next_move()) != MOVE_NONE + && (move = mp.get_next_move(&moveType)) != MOVE_NONE && !thread_should_stop(threadID)) { assert(move_is_ok(move)); bool singleReply = (isCheck && mp.number_of_moves() == 1); bool moveIsCheck = pos.move_is_check(move, dcCandidates); - bool moveIsCapture = pos.move_is_capture(move); + bool moveIsGoodCapture = (moveType == MovePicker::PH_GOOD_CAPTURES); bool moveIsPassedPawnPush = pos.move_is_passed_pawn_push(move); movesSearched[moveCount++] = ss[ply].currentMove = move; @@ -1176,7 +1175,7 @@ namespace { // Futility pruning if ( useFutilityPruning && ext == Depth(0) - && !moveIsCapture + && !moveIsGoodCapture && !moveIsPassedPawnPush && !move_promotion(move)) { @@ -1208,7 +1207,7 @@ namespace { if ( depth >= 2*OnePly && ext == Depth(0) && moveCount >= LMRNonPVMoves - && !moveIsCapture + && !moveIsGoodCapture && !move_promotion(move) && !moveIsPassedPawnPush && !move_is_castle(move) @@ -2022,7 +2021,6 @@ namespace { assert(threat == MOVE_NONE || move_is_ok(threat)); assert(!move_promotion(m)); assert(!pos.move_is_check(m)); - assert(!pos.move_is_capture(m)); assert(!pos.move_is_passed_pawn_push(m)); assert(d >= OnePly); @@ -2186,7 +2184,7 @@ namespace { bool overTime = t > AbsoluteMaxSearchTime || (RootMoveNumber == 1 && t > MaxSearchTime + ExtraSearchTime) - || ( !FailHigh && !fail_high_ply_1() && !Problem + || ( !FailHigh && !fail_high_ply_1() && !Problem && t > 6*(MaxSearchTime + ExtraSearchTime)); if ( (Iteration >= 2 && (!InfiniteSearch && overTime))