1
0
Fork 0

Save mateThreat flag in splitPoint and make use of it

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
sf_2.3.1_base
Joona Kiiski 2010-03-04 09:10:06 +02:00 committed by Marco Costalba
parent aeb664e0ea
commit 55f0d6377f
2 changed files with 8 additions and 8 deletions

View File

@ -84,7 +84,7 @@ namespace {
void put_threads_to_sleep(); void put_threads_to_sleep();
void idle_loop(int threadID, SplitPoint* waitSp); void idle_loop(int threadID, SplitPoint* waitSp);
bool split(const Position& pos, SearchStack* ss, int ply, Value* alpha, const Value beta, Value* bestValue, bool split(const Position& pos, SearchStack* ss, int ply, Value* alpha, const Value beta, Value* bestValue,
Depth depth, int* moves, MovePicker* mp, int master, bool pvNode); Depth depth, bool mateThreat, int* moves, MovePicker* mp, int master, bool pvNode);
private: private:
friend void poll(SearchStack ss[], int ply); friend void poll(SearchStack ss[], int ply);
@ -1219,7 +1219,7 @@ namespace {
&& !AbortSearch && !AbortSearch
&& !TM.thread_should_stop(threadID) && !TM.thread_should_stop(threadID)
&& TM.split(pos, ss, ply, &alpha, beta, &bestValue, && TM.split(pos, ss, ply, &alpha, beta, &bestValue,
depth, &moveCount, &mp, threadID, true)) depth, mateThreat, &moveCount, &mp, threadID, true))
break; break;
} }
@ -1546,7 +1546,7 @@ namespace {
&& !AbortSearch && !AbortSearch
&& !TM.thread_should_stop(threadID) && !TM.thread_should_stop(threadID)
&& TM.split(pos, ss, ply, NULL, beta, &bestValue, && TM.split(pos, ss, ply, NULL, beta, &bestValue,
depth, &moveCount, &mp, threadID, false)) depth, mateThreat, &moveCount, &mp, threadID, false))
break; break;
} }
@ -1782,7 +1782,6 @@ namespace {
// splitting, we don't have to repeat all this work in sp_search(). We // splitting, we don't have to repeat all this work in sp_search(). We
// also don't need to store anything to the hash table here: This is taken // also don't need to store anything to the hash table here: This is taken
// care of after we return from the split point. // care of after we return from the split point.
// FIXME: We are currently ignoring mateThreat flag here
void sp_search(SplitPoint* sp, int threadID) { void sp_search(SplitPoint* sp, int threadID) {
@ -1819,7 +1818,7 @@ namespace {
captureOrPromotion = pos.move_is_capture_or_promotion(move); captureOrPromotion = pos.move_is_capture_or_promotion(move);
// Step 11. Decide the new search depth // Step 11. Decide the new search depth
ext = extension(pos, move, false, captureOrPromotion, moveIsCheck, false, false, &dangerous); ext = extension(pos, move, false, captureOrPromotion, moveIsCheck, false, sp->mateThreat, &dangerous);
newDepth = sp->depth - OnePly + ext; newDepth = sp->depth - OnePly + ext;
// Update current move // Update current move
@ -1917,7 +1916,6 @@ namespace {
// don't have to repeat all this work in sp_search_pv(). We also don't // don't have to repeat all this work in sp_search_pv(). We also don't
// need to store anything to the hash table here: This is taken care of // need to store anything to the hash table here: This is taken care of
// after we return from the split point. // after we return from the split point.
// FIXME: We are ignoring mateThreat flag!
void sp_search_pv(SplitPoint* sp, int threadID) { void sp_search_pv(SplitPoint* sp, int threadID) {
@ -1953,7 +1951,7 @@ namespace {
captureOrPromotion = pos.move_is_capture_or_promotion(move); captureOrPromotion = pos.move_is_capture_or_promotion(move);
// Step 11. Decide the new search depth // Step 11. Decide the new search depth
ext = extension(pos, move, true, captureOrPromotion, moveIsCheck, false, false, &dangerous); ext = extension(pos, move, true, captureOrPromotion, moveIsCheck, false, sp->mateThreat, &dangerous);
newDepth = sp->depth - OnePly + ext; newDepth = sp->depth - OnePly + ext;
// Update current move // Update current move
@ -2894,7 +2892,7 @@ namespace {
bool ThreadsManager::split(const Position& p, SearchStack* sstck, int ply, bool ThreadsManager::split(const Position& p, SearchStack* sstck, int ply,
Value* alpha, const Value beta, Value* bestValue, Value* alpha, const Value beta, Value* bestValue,
Depth depth, int* moves, MovePicker* mp, int master, bool pvNode) { Depth depth, bool mateThreat, int* moves, MovePicker* mp, int master, bool pvNode) {
assert(p.is_ok()); assert(p.is_ok());
assert(sstck != NULL); assert(sstck != NULL);
@ -2929,6 +2927,7 @@ namespace {
splitPoint->stopRequest = false; splitPoint->stopRequest = false;
splitPoint->ply = ply; splitPoint->ply = ply;
splitPoint->depth = depth; splitPoint->depth = depth;
splitPoint->mateThreat = mateThreat;
splitPoint->alpha = pvNode ? *alpha : beta - 1; splitPoint->alpha = pvNode ? *alpha : beta - 1;
splitPoint->beta = beta; splitPoint->beta = beta;
splitPoint->pvNode = pvNode; splitPoint->pvNode = pvNode;

View File

@ -53,6 +53,7 @@ struct SplitPoint {
const Position* pos; const Position* pos;
bool pvNode; bool pvNode;
Depth depth; Depth depth;
bool mateThreat;
Value beta; Value beta;
int ply, master, slaves[MAX_THREADS]; int ply, master, slaves[MAX_THREADS];
SearchStack sstack[MAX_THREADS][PLY_MAX_PLUS_2]; SearchStack sstack[MAX_THREADS][PLY_MAX_PLUS_2];