From: H.G.Muller Date: Tue, 10 Apr 2018 15:21:53 +0000 (+0200) Subject: Make reference to mini-Shogi symbolic X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=a377607ffc64bd75a2490d49aca8e36f6c7fe227;p=crazywa.git Make reference to mini-Shogi symbolic I various parts of the code it was assumed that mini-Shogi was listed as second variant in the variant-definition array. To make it easier to reshuffle variants a macro MINI_NR, #defined close to the array, makes it easier to shuffle the order of variants. --- diff --git a/dropper.c b/dropper.c index 4bf5dff..eaea10c 100644 --- a/dropper.c +++ b/dropper.c @@ -400,8 +400,9 @@ VariantDesc variants[] = { { 7, 7, 6, 2, "torishogi\n", toriIDs, toriFEN, toriDirs, toriProms, toriCodes, toriValues }, }; -#define TORI_NR 7 /* must correspond to index of torishogi (which must be last) in table above! */ -#define KNIGHTLESS 4 /* first variant without a Knight (except mini-, which has no 2-rank zone) */ +#define TORI_NR 7 /* must correspond to index of torishogi (which must be last) in table above! */ +#define MINI_NR 1 +#define KNIGHTLESS 4 /* first variant without a Knight (except mini-, which has no 2-rank zone) */ // info per piece type. sometimes indexed by negated holdings count instead of piece #define pieceKey (rawKey+1) @@ -491,7 +492,7 @@ GameInit (char *name) printf("\n"); } - maxDrop += (v==2 || v==1); // Judkins & mini-Shogi have dummy Lance + maxDrop += (v==MINI_NR+1 || v==MINI_NR); // Judkins & mini-Shogi have dummy Lance // board ClearBoard(); @@ -578,7 +579,7 @@ GameInit (char *name) } for(r=0; r=d; i-=2) if(checkHist[i+1] == CK_NONE) break; if(i < d) score = INF-1; // we are suffering a perpetual, so lose - else if(perpLoses == 1) score = (stm == WHITE ? -INF : INF-1); // mini-Shogi, sente loses + else if(perpLoses == MINI_NR) score = (stm == WHITE ? -INF : INF-1); // mini-Shogi, sente loses else if(perpLoses == TORI_NR) score = -INF; // Tori Shogi, repeating loses }