I'm implementing the PVS+ZWS from http://chessprogramming.wikispaces.com/ ... ion+Search.
I though it helped dramatically for the time-to-depth (12 plies in seconds) but that was caused by a bug (position hash was not removed from history-list (for move repetition detection)).
Now the results are underwhelming.
My regular alpha/beta searcher reaches depth 6 in 2 seconds:
Code: Select all
info depth 6 seldepth 6 score cp 2 time 2025 nodes 283186 pv b1c3 d7d5 e2e3 d8d6
Code: Select all
info depth 6 seldepth 6 score cp 2 time 7595 nodes 887015 pv b1c3 d7d5 e2e3 d8d6
For starters: I'm not sure when to select the move. Only when score > alpha? Or also for the beta-cut-off? or?
search
Code: Select all
function search()
loop_through_movelist() {
make_move();
int score = 0;
// addToHistory checks for position repetition
if (!addToHistory(sd -> history, newHash.newHash))
{
if (bSearchPv)
score = -search(sd, newDepth, co, -beta, -alpha, newHash, stopFlag, false, mCurPrevBest, false, &tempPv);
else
{
score = -zwSearch(sd, co, -alpha, newDepth, newHash, stopFlag);
if (score > alpha)
score = -search(sd, newDepth, co, -beta, -alpha, newHash, stopFlag, false, mCurPrevBest, false, &tempPv);
}
}
removeFromToHistory(sd -> history, newHash.newHash);
unmake_move();
if (score > bestVal)
{
bestVal = score; // bestVal is the value which is returned at the end of the function
mBestMove = cm;
newPv.assign(tempPv, false); // keep track of pv
mCurPrevBest = tempPv.back(); // use this move, so this is for the root
if (score >= beta)
{
bestVal = beta;
betaCutOff = true;
break;
}
if (score > alpha)
{
alpha = score;
bSearchPv = false;
}
}
Code: Select all
if (depthLeft == 0)
return quiesceSearch(sd, c, beta - 1, beta, zh, stopFlag, invalidMove, &moveDummy, &pvDummy);
for(size_t idx=0; idx<nMoves && !*stopFlag; idx++)
{
make_move(idx);
int score = 0;
if (!addToHistory(sd -> history, newHash.newHash))
score = -zwSearch(sd, co, 1 - beta, depthLeft - 1, newHash, stopFlag);
removeFromToHistory(sd -> history, newHash.newHash);
unmake_move(idx);
if (score >= beta)
return beta; // fail-hard beta-cutoff
}
return beta - 1; // fail-hard, return alpha
regards