From ed4bd26a922c5bd6b7695fa43446ff5b62d43ce3 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Mon, 11 Feb 2013 22:41:51 +0100 Subject: [PATCH] Auto-determine pair bonus Color-binding is determined for simple moves (if there is no secondary step), and a pair bonus of 1/8 of the base value is awarded by default. --- fairymax.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/fairymax.c b/fairymax.c index 6c4ea12..54bcf60 100644 --- a/fairymax.c +++ b/fairymax.c @@ -512,9 +512,11 @@ void LoadGame(char *name) { od[++i]=j; centr[i] = c>='a'; blacktype[c&31]=i; piecename[i]=c&31; if(piecetype[c&31]==0) piecetype[c&31]=i; // only first + pb[i] = pb[i+16] = w[i]>>3 & ~3; // pair bonus, for now 1/8 of piece value, leave low bits for flag succession |= w[i] < -4; // expendable royalty; assume we can promote to it } else { - if(!o[j]) pb[i] = pb[i+16] = of[j--]; // hand-set pair bonus + if((o[j]^o[j]+8>>4)&1 || of[j]>>4) pb[i] = pb[i+16] = 0; // not color bound (or too complex to see it), so no pair bonus + if(!o[j]) pb[i] = pb[i+16] = of[j--]; // hand-set pair bonus kludges: 3 for mating minor, negative for non-mating pair. } j++; o[j]=0; /* printf("# c='%c' i=%d od[i]=%d j=%d (%3d,%8x)\n",c?c:' ',i,od[i],j,o[j-1],of[j-1]); /**/ -- 1.7.0.4