Penalize King view in eval
authorH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 6 Feb 2017 17:22:26 +0000 (18:22 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 6 Feb 2017 17:22:26 +0000 (18:22 +0100)
An asymmetric eval penalty is given for each square from which a distant
check can be given.

dropper.c

index 3a4f513..14a7148 100644 (file)
--- a/dropper.c
+++ b/dropper.c
@@ -712,20 +712,29 @@ static int rightsScore[] = { 0, -10, 10, 0, -10, -30, 0, -20, 10, 0, 30, 20, 0,
 int
 Evaluate (int stm, int rights)
 {
-    int k, s, score = 0;
+    static int rays[] = {1, -1, 22, -22, 23, -23, 21, -21 };
+    int k, f, s, score = 0, w, b;
     k = location[WHITE+31]; s = (k >= 1*22)*6 + 1;
     score += ((board[k+22] == WHITE) + ((board[k+22+1] == WHITE) + (board[k+22-1] == WHITE) - 2)*s)*2;
     score += (!board[k+1] + !board[k-1])*(board[k+22] != BLACK)*5;
     score -= (2*(board[k+22] == BLACK) + (board[k+44] == BLACK) + (board[k+44+1] == BLACK) + (board[k+44-1] == BLACK))*5;
+    for(f=w=0; f<8; f++) { // mark squares from which 
+       int v = rays[f], x = k + v;
+       if(!board[x]) while(!board[x+=v]) w++;
+    }
     if(k >= killZone) score -= 100;
     k = location[BLACK+31]; s = (k < boardEnd - 1*22)*6 + 1;
     score -= ((board[k-22] == BLACK) + ((board[k-22+1] == BLACK) + (board[k-22-1] == BLACK) - 2)*s)*2;
     score -= (!board[k+1] + !board[k-1])*(board[k-22] != WHITE)*5;
     score += (2*(board[k-22] == WHITE) + (board[k-44] == WHITE) + (board[k-44+1] == WHITE) + (board[k-44-1] == WHITE))*5;
+    for(f=b=0; f<8; f++) { // mark squares from which 
+       int v = rays[f], x = k + v;
+       if(!board[x]) while(!board[x+=v]) b++;
+    }
     if(k < boardEnd - killZone) score += 100;
     score *= 5;
     score += rightsScore[rights];
-    return stm == WHITE ? score : -score;
+    return stm == WHITE ? score + 15*b - 9*w : -score - 15*w + 9*b;
 }
 
 int