Code: Select all
int pvSearch( int alpha, int beta, int depth ) {
if( depth == 0 ) return quiesce(alpha, beta);
bool bSearchPv = true;
for ( all moves) {
make
if ( bSearchPv ) {
score = -pvSearch(-beta, -alpha, depth - 1);
} else {
score = -zwSearch(-alpha, depth - 1);
if ( score > alpha ) // in fail-soft ... && score < beta ) is common
score = -pvSearch(-beta, -alpha, depth - 1); // re-search
}
unmake
if( score >= beta )
return beta; // fail-hard beta-cutoff
if( score > alpha ) {
alpha = score; // alpha acts like max in MiniMax
bSearchPv = false; // *1)
}
}
return alpha;
}
// fail-hard zero window search, returns either beta-1 or beta
int zwSearch(int beta, int depth ) {
// alpha == beta - 1
// this is either a cut- or all-node
if( depth == 0 ) return quiesce(beta-1, beta);
for ( all moves) {
make
score = -zwSearch(1-beta, depth - 1);
unmake
if( score >= beta )
return beta; // fail-hard beta-cutoff
}
return beta-1; // fail-hard, return alpha
}
1-should the ordering differ from PVS to zwSearch .
2-what techniques should be used in PVS and in zwSearch, for example should null & late pruning be used in both.
3-how should I use the ttvalues in both searches and what result should I store ?
4-if fail-soft gives different results in normal alpha beta routine than fail hard , does this indicate a problem or is it a normal search instability.
5-is it worth it to use an aspiration window with PVS ?
6-right now the evaluation is based on material difference ,mobility ,some pawn stuff (passed ,double,..) what is the next most important aspect to implement ?