From: H.G. Muller Date: Tue, 27 Dec 2011 14:02:30 +0000 (+0100) Subject: Add setting up of holdings in variant seirawan X-Git-Tag: 4.8S~22 X-Git-Url: http://winboard.nl/cgi-bin?p=fairymax.git;a=commitdiff_plain;h=28d45d9a9d1df30f7230bbdbbec81e3eb9c9276c Add setting up of holdings in variant seirawan In WB edit mode lines of the form P@N put N copies of piece type P in the Seirawan holdings, and the xedit=1 feature lets WB send it this way. Should not be used for other pieces than H or E! --- diff --git a/fairymax.c b/fairymax.c index c68ca20..83002e5 100644 --- a/fairymax.c +++ b/fairymax.c @@ -608,7 +608,7 @@ int main(int argc, char **argv) if (!strcmp(command, "protover")) { printf("feature myname=\"" NAME " " VERSION "\"\n"); printf("feature memory=1\n"); - printf("feature setboard=0 ping=1 done=0\n"); + printf("feature setboard=0 xedit=1 ping=1 done=0\n"); printf("feature variants=\""); PrintVariants(0); printf("\"\n"); @@ -815,11 +815,18 @@ int main(int argc, char **argv) Q = -Q; continue; } - if( m >= 'A' && m <= 'Z' && piecetype[m&31] - && line[1] >= 'a' && line[1] <= 'a'+BW-1 + if( m >= 'A' && m <= 'Z' && piecetype[m&31]) { + p = (color == WHITE ? piecetype : blacktype)[line[0]&31]; + if(line[1] == '@') { // stuff holdings + pl[color+p+5] = m = line[2] - '0'; + pl[BLACK+WHITE-color]+=m;pl[p+color]+=m; + Q+=m*w[p]; R+=m*(w[p]/FAC); + continue; + } else + if(line[1] >= 'a' && line[1] <= 'a'+BW-1 && line[2] >= '1' && line[2] <= '0'+BH) { m = line[1]-16*line[2]+799; - switch(p = (color == WHITE ? piecetype : blacktype)[line[0]&31]) + switch(p) { case 1: case 2: @@ -843,6 +850,7 @@ int main(int argc, char **argv) pl[BLACK+WHITE-color]++;pl[p+color]++; if(w[p+color] == -1)pl[p+color]=1; // fake we have one if value = -1, to thwart extinction condition continue; + } } } if(Side != color) Q = -Q;