using PVS Algorithm with Quiet search and zero window search what should the range of the score be (-infinity, infinity ) could it be as small as (-16000,16000) and what should the search return if it's a stalemate or checkmate for me or for the other side ? I tried reading the source code of different engines but there is too much addition(heuristics and such) that make it too difficult for me to understand anything.
the question in another for given this PVS algorithm how and where should I place checking for chaeck/stale mate and what score should I return ?
int PVS(alfa,beta,depthleft) {
if( depthleft <= 0 ) return qsearch(alpha, beta);
// using fail soft with negamax:
make first move
bestscore = -PVS(-beta, -alpha, depthleft-1);
unmake first move
if( bestscore > alpha ) {
if( bestscore >= beta )
return bestscore;
alpha = bestscore;
}
for( all remaining moves ) {
make move
score = -PVS(-alpha-1, -alpha, depthleft-1); // alphaBeta or zwSearch
if( score > alpha && score < beta ) {
// research with window [alpha;beta]
score = -PVS(-beta, -alpha, depthleft-1);
if( score > alpha )
alpha = score;
}
unmake move
if( score > bestscore ) {
if( score >= beta )
return score;
bestscore = score;
}
}
return bestscore;
}
I wasn't sure where to post this question here or on stack overflow so please migrate it as you see fit