summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
acef5d6)
However just after finished writing this patch I realized that this
is not the way to go. So this will be immediately reverted.
(Just save this here in git in case I change my mind later :) )
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
Value root_search(Position &pos, SearchStack ss[], RootMoveList &rml, Value alpha, Value beta) {
Value root_search(Position &pos, SearchStack ss[], RootMoveList &rml, Value alpha, Value beta) {
- //FIXME: Implement bestValue
+ Value bestValue = -VALUE_INFINITE;
Value oldAlpha = alpha;
Value value;
Bitboard dcCandidates = pos.discovered_check_candidates(pos.side_to_move());
Value oldAlpha = alpha;
Value value;
Bitboard dcCandidates = pos.discovered_check_candidates(pos.side_to_move());
// Loop through all the moves in the root move list
for (int i = 0; i < rml.move_count() && !AbortSearch; i++)
{
// Loop through all the moves in the root move list
for (int i = 0; i < rml.move_count() && !AbortSearch; i++)
{
+ if (alpha >= beta) { //Aspiration window failed high, ignore rest of the moves!
rml.set_move_score(i, -VALUE_INFINITE);
//Leave node-counters and beta-counters as they are.
continue;
rml.set_move_score(i, -VALUE_INFINITE);
//Leave node-counters and beta-counters as they are.
continue;
assert(value >= -VALUE_INFINITE && value <= VALUE_INFINITE);
assert(value >= -VALUE_INFINITE && value <= VALUE_INFINITE);
- if (value <= alpha && i >= MultiPV)
+ if (value <= bestValue && i >= MultiPV)
rml.set_move_score(i, -VALUE_INFINITE);
else
{
rml.set_move_score(i, -VALUE_INFINITE);
else
{
LogFile << pretty_pv(pos, current_search_time(), Iteration, nodes_searched(), value, ss[0].pv)
<< std::endl;
LogFile << pretty_pv(pos, current_search_time(), Iteration, nodes_searched(), value, ss[0].pv)
<< std::endl;
- if (value > alpha)
- alpha = value;
+ if (value > bestValue)
+ {
+ bestValue = value;
+ if (value > alpha)
+ alpha = value;
+ }
// Reset the global variable Problem to false if the value isn't too
// far below the final value from the last iteration.
// Reset the global variable Problem to false if the value isn't too
// far below the final value from the last iteration.
std::cout << std::endl;
}
alpha = rml.get_move_score(Min(i, MultiPV-1));
std::cout << std::endl;
}
alpha = rml.get_move_score(Min(i, MultiPV-1));
+ bestValue = alpha; //In MultiPV-mode bestValue and alpha are always same thing.
+ if (bestValue <= oldAlpha)
FailLow = true;
else
FailLow = false;
}
FailLow = true;
else
FailLow = false;
}