From: H.G.Muller Date: Mon, 2 Jun 2014 17:42:38 +0000 (+0200) Subject: Fix futility pruning X-Git-Url: http://winboard.nl/cgi-bin?p=hachu.git;a=commitdiff_plain;h=a494f710fd8564278ece8d843573e06b05bb1ec8 Fix futility pruning Move generation was stopped at d=1 when futile victims were reached, but after deepening to d>=2 the victim for which this first happened was never tried again. In addition, the upper-bound score was not adapted to the estimated gain, meaning it could remain at the initial -INF, creating the permanent impression that the current position was a checkmate. --- diff --git a/hachu.c b/hachu.c index 0c8a239..a8828c5 100644 --- a/hachu.c +++ b/hachu.c @@ -1909,7 +1909,11 @@ if(PATH) printf("%d:%2d:%2d next victim %d/%d\n",level,depth,iterDep,curMove,msp if(to == ABSENT) continue; // ignore if absent if(!attacks[2*to + stm]) continue; // skip if not attacked group = p[nextVictim].value; // remember value of this found victim - if(iterDep <= QSdepth + 1 && 2*group + curEval + 30 < alpha) { resDep = QSdepth + 1; goto cutoff; } + if(iterDep <= QSdepth + 1 && 2*group + curEval + 30 < alpha) { + resDep = QSdepth + 1; nextVictim -= 2; + if(bestScore < 2*group + curEval + 30) bestScore = 2*group + curEval + 30; + goto cutoff; + } if(PATH) printf("%d:%2d:%2d group=%d, to=%c%d\n",level,depth,iterDep,group,to%BW+'a',to/BW+ONE); GenCapts(to, 0); if(PATH) printf("%d:%2d:%2d first=%d msp=%d\n",level,depth,iterDep,firstMove,msp);