From: H.G.Muller Date: Mon, 6 Feb 2017 17:01:19 +0000 (+0100) Subject: Penalize King advance X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=6b484e1b9ce830e85dbd24e4491161cad5f73591;p=crazywa.git Penalize King advance Advancing the King to before the Pawns now gets penalized, both in the normal evaluation and in the King Seige term. Impasses because of reaching the promotion zone are awarded. --- diff --git a/dropper.c b/dropper.c index eb395b9..2ea7144 100644 --- a/dropper.c +++ b/dropper.c @@ -62,6 +62,7 @@ int moveNr; // part of game state; incremented by MakeMove int pvStack[MAXPLY*MAXPLY/2]; int nrRanks, nrFiles, specials, pinCodes, maxDrop, moveSP, pawn, lanceMask, *pvPtr = pvStack, boardEnd, perpLoses, searchNr; +int frontier, killZone, impasse, frontierPenalty, killPenalty; int rawInts[21*22], pieceValues[96], pieceCode[96]; signed char rawChar[32*22], steps[512]; unsigned char rawByte[102*22], firstDir[64], rawBulk[98], handSlot[97], promoCode[96], aVal[64], vVal[64], rawLocation[96+23], handBulk[96]; @@ -463,6 +464,11 @@ printf("# variant %d: %s\n", v, variants[v].name); // board ClearBoard(); boardEnd = specials = 22*nrRanks; + frontier = (nrRanks < 7 ? 22 : nrRanks == 7 ? 2*22 : 3*22); + killZone = boardEnd - (nrRanks > 6 ? frontier + 2*22 : 0); + impasse = boardEnd - (nrRanks > 6 ? 3*22 : 2*22); + frontierPenalty = (nrRanks > 7 ? 2 : 1); + killPenalty = (nrRanks > 7 ? 8 : 2); for(i=0; i= killZone) score -= 100; k = location[WHITE+31]; score -= ((board[k-22] == BLACK) + (board[k-22+1] == BLACK) + (board[k-22-1] == BLACK))*2; score += !board[k-22] + !board[k-22+1] + !board[k-22-1]; score += ((board[k-44] == WHITE) + (board[k-44+1] == WHITE) + (board[k-44-1] == WHITE))*5; + if(k < boardEnd - killZone) score += 100; score *= 20; score += rightsScore[rights]; return stm == WHITE ? score : -score; @@ -825,7 +834,8 @@ MoveGen (int stm, MoveStack *m, int castle) m->safety = SAFE(r+1) + SAFE(r-1) + SAFE(r+22) + SAFE(r+21) + SAFE(r+23) + SAFE(r-21) + SAFE(r-22) + SAFE(r-23); # define ESC(X) (board[X] & stm || attacks[X] == c) m->escape = 8 - (ESC(r+1) + ESC(r-1) + ESC(r+22) + ESC(r+21) + ESC(r+23) + ESC(r-21) + ESC(r-22) + ESC(r-23)); - + if(stm == WHITE) r = boardEnd - 1 - r; + m->safety += (r >= 1*22) + frontierPenalty*(r >= frontier) + killPenalty*(r >= killZone) - 5*(r >= impasse); m->unsorted = m->firstMove; m->drops = moveSP; return 0; }