X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=fairymax.c;h=ce2d7ae4e2eea85d5bfebc5ee51622235824ae48;hb=cdb80be80d2895990ffe4b3f88ab566e5553ca3c;hp=205e89bec67441b2bad77133bc19ad84a38ad3f9;hpb=a3fd272813e903e7dcbfa9f80d27d1ecdbc08738;p=fairymax.git diff --git a/fairymax.c b/fairymax.c index 205e89b..ce2d7ae 100644 --- a/fairymax.c +++ b/fairymax.c @@ -93,7 +93,7 @@ int Resign; int Threshold = 800; int Score; int makruk; -int prom, pm; +int prom, pm, gating; char piecename[32], piecetype[32], blacktype[32]; char selectedFairy[80]; char *inifile = INI_FILE; @@ -226,7 +226,7 @@ int k,q,l,e,E,z,n; /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/ Fifty = t|p<3?0:Fifty+1; sp=ps; if(!(u&32)&PromPiece&(K&112)==(k?0:112)) - prom=b[K]=39+k-PromPiece,J++,pl[k+14-PromPiece]--; /* gating */ + prom=b[K]=39+k-PromPiece,J+=333,pl[k+14-PromPiece]--; /* gating */ return l;} /* & not in check, signal */ v=m; /* (prevent fail-lows on */ } /* K-capt. replies) */ @@ -389,6 +389,7 @@ InitGame() R -= 2*(-k/FAC); UnderProm = -1; pl[WHITE] = pl[BLACK] = 2*BW; pm = !pl[BLACK+7] && pl[BLACK+9] && pl[WHITE+7] ? 2 : 0; // Unlike white, black has no 'Q', so promote to 9, which he does have. + if(gating) pl[13] = pl[15] = pl[29] = pl[31] = 1, R += 2*(w[6]/FAC + w[8]/FAC); } void CopyBoard(int s) @@ -454,9 +455,11 @@ int LoadGame(char *name) if(fscanf(f, "version 4.8(%c)", &c)!=1 || c != 'w') { printf("telluser incompatible fmax.ini file\n"); exit(0); } + gating = 0; if(name != NULL) { /* search for game name in definition file */ - if(!strcmp(name, "fairy")) name = selectedFairy; + if(!strcmp(name, "fairy")) name = selectedFairy; + gating = !strcmp(name, "seirawan"); while((ptc=fscanf(f, "Game: %s # %s", buf, pieceToChar))==0 || strcmp(name, buf) ) { while((c = fgetc(f)) != EOF && c != '\n'); count++; @@ -550,6 +553,8 @@ int main(int argc, char **argv) N=0;K=I; if (D(Side,-I,I,Q,O,LL|S,3)==I) { Side ^= BLACK^WHITE; + if(b[K]&&Score+D(Side,-I,I,Q,2*S,2*S,2)>S) + prom=b[K]=0,J-=333,pl[30-Side-PromPiece]++; /* undo bad gating */ if(UnderProm>=0 && UnderProm != L) { printf("tellics I hate under-promotions!\n"); printf("resign { underpromotion } \n"); @@ -782,7 +787,6 @@ int main(int argc, char **argv) sscanf(line, "variant %s", command); LoadGame(command); InitGame(); Setup = 0; - if(strstr(command,"seirawan")) pl[13] = pl[15] = pl[29] = pl[31] = 1; continue; } if (!strcmp(command, "edit")) {