From: H.G.Muller Date: Wed, 11 Apr 2018 18:35:08 +0000 (+0200) Subject: Improve move sorting X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=3ef60e9b404d0ed2dd49a2b948671c89efaef904;p=crazywa.git Improve move sorting Just prepending the best move as a duplicat, an relying on a hash hit to skip searching the later occurrence, is not satisfactory in multi-PV mode, as moves with the same score would both output a PV. We now erase the original move (by setting it to the invalid 0), an skip such moves in the move loop. --- diff --git a/dropper.c b/dropper.c index de421e3..d0a5ad5 100644 --- a/dropper.c +++ b/dropper.c @@ -1436,7 +1436,7 @@ Search (int stm, int alpha, int beta, StackFrame *ff, int depth, int reduction, } } - if(ply == 0 && moveMap[moveStack[curMove] & 0xFFFF]) continue; // excluded root move + if(!moveStack[curMove] || ply == 0 && moveMap[moveStack[curMove] & 0xFFFF]) continue; // erased, or excluded root move // make move if(MakeMove(&f, moveStack[curMove])) { // aborts if fails to evade existing check @@ -1536,7 +1536,8 @@ printf("%d:%d:%d %2d. %08x %c%d%c%d %6d %6d %6d\n",ply,depth,iterDepth,curMove,m // put best in front if(bestNr > m.firstMove) { int bestMove = moveStack[bestNr]; - if(bestNr == m.firstMove+1) moveStack[bestNr] = moveStack[m.firstMove]; else m.firstMove--; // swap first two, or prepend duplicat + if(bestNr == m.firstMove+1) moveStack[bestNr] = moveStack[m.firstMove]; // swap first two + else m.firstMove--, moveStack[bestNr] = 0; // or prepend and erase in original location moveStack[bestNr = m.firstMove] = bestMove; } else m.late += (m.late == bestNr); // if best already in front (or non-existing), just make sure it is not reduced