X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=fairymax.c;h=5341cd2fd00cb9983840fde9d22ac0ad347e646e;hb=b6a7fa8ae7c54db7bb5a9415ccae3fd55e9b360e;hp=769da7f25c4d1d7ee0af79240ec5c5adf6a83a94;hpb=0a8207c5bba7eac72a459e18be5cbd8df35b1704;p=fairymax.git diff --git a/fairymax.c b/fairymax.c index 769da7f..5341cd2 100644 --- a/fairymax.c +++ b/fairymax.c @@ -100,7 +100,7 @@ int Post; int Fifty; int GameNr; int Resign; -int Cambodian; +char Cambodian[80] = "makruk"; int Threshold = 800; int Score; int makruk; @@ -149,7 +149,7 @@ D(k,q,l,e,E,z,n) /* recursive minimax search, k=moving side, n=depth*/ int k,q,l,e,E,z,n; /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/ { /* e=score, z=prev.dest; J,Z=hashkeys; return score*/ int j,r,m,v,d,h,i,F,G,P,V,f=J,g=Z,C,s,flag,FF,*ps=sp,kk=S; - signed char t,p,u,x,y,X,Y,H,B,gt; + signed char t,p,u,x,y,X,Y,H,B,gt,rg,rk; struct _*a=A+(J+(k+S)*E&U); /* lookup pos. in hash table*/ *sp++=0; q-=q>10&3; /* (x,y)=move, (F,G)=castl.R*/ do{ /* y traverses ray, or: */ H=y=h?Y^h:y+r; /* sneak in prev. best move */ if(flag&1<<8)H=y=(y&15)>13?y+BW:(y&15)>=BW?y-BW:y; /* cylinder board */ @@ -199,7 +199,7 @@ int k,q,l,e,E,z,n; /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/ if(d-!t>1) /*** all captures if d=2 ***/ {v=gt=0;G: /* retry move with gating */ v+=centr[p]?b[x+257]-b[y+257]:0; /* center positional pts. */ - if(!(G&S))b[FF]=b[G],v+=50; /* castling: put R & score */ + if(G-S)b[FF]=(rk=b[G])|32,v+=50; /* castling: put R & score */ b[G]=b[H]=0;b[x]=gt;b[y]=u|32; /* do move, set non-virgin */ pl[t&31]-=!!t; /* updat victim piece count */ v-=w[p]>0|R>sh), /* correct piece & score & */ Z+=PromPiece; /* invalidate hash */ a->D=99;a->V=0; /* lock game in hash as draw*/ R-=i/FAC; /*** total captd material ***/ @@ -242,7 +242,7 @@ int k,q,l,e,E,z,n; /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/ v=m; /* (prevent fail-lows on */ } /* K-capt. replies) */ SHAMAX( pl[k]+=!!t; ) pl[t&31]+=!!t; - b[G]=b[FF];b[FF]=b[y]=0;b[x]=u;b[H]=t; /* undo move,G can be dummy */ + b[G]=rk;b[FF]=b[y]=0;b[x]=u;b[H]=t; /* undo move,G can be dummy */ } /* if non-castling */ if(z&S&&K==I&d>2&v>V&v>4&15; /* hoppers go to next phase */ - if(!(flag&S)) /* zig-zag piece? */ + if(--rg<0&!(flag&S)) /* zig-zag piece? (w. delay)*/ r=v,flag^=flag>>4&15; /* alternate vector & mode */ }W(!t); /* if not capt. continue ray*/ }} @@ -455,7 +455,7 @@ void PrintOptions() printf("feature option=\"Ini File -file %s\"\n", inifile); printf("feature option=\"Multi-PV Margin -spin %d 0 1000\"\n", margin); printf("feature option=\"Variant fairy selects -combo "); PrintVariants(1); printf("\"\n"); - printf("feature option=\"Cambodian Makruk rules -check %d\"\n", Cambodian); + printf("feature option=\"Makruk rules -combo makruk /// cambodian /// ai-wok\"\n"); printf("feature option=\"Dummy Slider Example -slider 20 0 100\"\n"); printf("feature option=\"Dummy String Example -string happy birthday!\"\n"); printf("feature option=\"Dummy Path Example -path .\"\n"); @@ -480,7 +480,7 @@ void LoadGame(char *name) gating = succession = 0; if(name != NULL) { /* search for game name in definition file */ - if(!strcmp(name, "makruk") && Cambodian) name = "cambodian"; else + if(!strcmp(name, "makruk")) name = Cambodian; else if(!strcmp(name, "fairy")) name = selectedFairy; gating = !strcmp(name, "seirawan"); while((ptc=fscanf(f, "Game: %s # %s", buf, pieceToChar))==0 || strcmp(name, buf) ) { @@ -498,6 +498,7 @@ void LoadGame(char *name) /* We have found variant, or if none specified, are at beginning of file */ if(fscanf(f, "%dx%d", &BW, &BH)!=2 || BW>12 || BH!=8) { printf("telluser unsupported board size %dx%d\n",BW,BH); exit(0); } + makruk = 0; if(fscanf(f, "=%d", &i)) makruk=64; // new method to indicate deviant zone depth (for now assumes 3) for(i=0; iK = 0; if(sscanf(line+7, "MultiVariation Margin=%d", &margin) == 1) continue; if(sscanf(line+7, "Variant fairy selects=%s", selectedFairy+6) == 1) continue; - if(sscanf(line+7, "Cambodian Makruk rules=%d", &Cambodian) == 1) continue; + if(sscanf(line+7, "Makruk rules=%s", Cambodian) == 1) continue; continue; } if (!strcmp(command, "go")) {