From 901e20ac0eaa481baab3d14c097aa2da12db39ea Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Mon, 6 Feb 2017 18:22:26 +0100 Subject: [PATCH] Penalize King view in eval An asymmetric eval penalty is given for each square from which a distant check can be given. --- dropper.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/dropper.c b/dropper.c index 3a4f513..14a7148 100644 --- 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 -- 1.7.0.4