Define 11x17+16_chu as alias for Wa Shogi
authorH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 29 May 2017 18:35:43 +0000 (20:35 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 29 May 2017 18:35:43 +0000 (20:35 +0200)
Under the WinBoard 'Alien Edition' Wa Shogi has to be played as a variant
of Chu Shogi with modified board size. To accomodate the holdings, the
board must be 11x17, and needs the extra ranks blacked out. We thus added
11x17+16_chu as a duplicat of crazywa. The blacked-out ranks will appear
in the FEN of a setboard command as asterisks, so the FEN reader had to
be made to ignore these.

dropper.c

index d911549..dff73d0 100644 (file)
--- a/dropper.c
+++ b/dropper.c
@@ -385,6 +385,7 @@ VariantDesc variants[] = {
   {  6,  6,  6, 2, "judkinshogi\n", shogiIDs, judkinFEN, shogiDirs, shogiProms, shogiCodes, judkinValues },
   {  9,  9,  7, 3, "shogi\n",       shogiIDs, shogiFEN,  shogiDirs, shogiProms, shogiCodes, shogiValues },
   { 11, 11, 16, 3, "crazywa\n",     waIDs,    waFEN,     waDirs,    waProms,    shogiCodes, waValues    }, 
+  { 11, 11, 16, 3, "11x17+16_chu\n",waIDs,    waFEN,     waDirs,    waProms,    shogiCodes, waValues    }, 
   {  7,  7,  6, 2, "torishogi\n",   toriIDs,  toriFEN,   toriDirs,  toriProms,  toriCodes,  toriValues  },
 };
 
@@ -627,7 +628,7 @@ printf("# variant %d: %s\n", v, variants[v].name);
     for(f=0,p=pstType[v]; *p; p++,f++) if(*p == ' ') f = 15; else  PST[BLACK+f] = (PST[WHITE+f] = pstData + 22*11*(*p - '0')) + 11*(*p > '2'); 
 
     InitCaptureCodes(variants[v].codes);
-    pinCodes = (v == 5 ? 0xFF2C : 0xFF1F); // rays along which pinning ispossible
+    pinCodes = (v == 6 ? 0xFF2C : 0xFF1F); // rays along which pinning is possible
 }
 
 void
@@ -913,7 +914,7 @@ EvasionDrops (int stm, StackFrame *f, int mask)
        i = zoneTab[x] & Z_LAST; // Pawn not on first & last rank (OK for zh)
        if(perpLoses) { // but it is Shogi!
            if(!(zoneTab[x] & stm)) i = 0; // outside zone, so dropping is always allowed
-           else if(perpLoses < 5) {       // Shogi variant with Lance
+           else if(perpLoses < 6) {       // Shogi variant with Lance
                i *= 2;                    // no Pawn, then also no Lance!
                last += 1 - (zoneTab[x] & (Z_2ND & ~COLOR)) + (perpLoses & 4) >> 3; // on last 2 ranks trim off Knight (not in Wa)
            }
@@ -1342,7 +1343,7 @@ Search (int stm, int alpha, int beta, StackFrame *ff, int depth, int reduction,
                                for(i=moveNr+ply-2; i>=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 == 5) score = -INF; // Tori Shogi, repeating loses
+                               else if(perpLoses == 6) score = -INF; // Tori Shogi, repeating loses
                            }
                           
                        }
@@ -1499,11 +1500,13 @@ Setup (char *fen)
   int pstEval, rights, stm = WHITE, i, p, sqr = 22*(nrRanks-1); // upper-left corner
   ClearBoard();
   if(!fen) fen = startFEN; else strcpy(startFEN, fen); // remember start position, or use remembered one if not given
+  if(strchr(fen, '*') && strlen(fen) > 30) fen += 18;  // Alien-Edition Wa implementation; strip off leading 11/11/***********/
   rights = 15; pstEval = 0;               // no castling rights, balance score
   hashKey = pawnKey = 0;                  // clear hash keys
   while(*fen) {                                       // parse board-field of FEN
     if(*fen == ' ' || *fen == '[') break;
     if(*fen == '/') sqr = 22*(sqr/22) - 22; else      // skip to (start of) next rank
+    if(*fen == '*') fen++; else                       // ignore dark squares
     if(*fen <= '9' && *fen >= '0') {
       int n = atoi(fen); sqr += n; fen += (n > 9);    // skip given number of squares (and second digit of 10 or 11)
     } else {
@@ -1753,7 +1756,7 @@ printf("# command: %s\n", inBuf);
     if(!strcmp(command, "protover")){
       printf("feature ping=1 setboard=1 colors=0 usermove=1 memory=1 debug=1 reuse=0 sigint=0 sigterm=0 myname=\"CrazyWa " VERSION "\"\n");
       printf("feature variants=\"crazyhouse,shogi,minishogi,judkinshogi,torishogi,euroshogi,crazywa,"
-                               "5x5+5_shogi,6x6+6_shogi,7x7+6_shogi,11x11+16_shogi,8x8+6_crazyhouse,8x8+7_crazyhouse\"\n");
+                               "5x5+5_shogi,6x6+6_shogi,7x7+6_shogi,11x17+16_chu\"\n");
       printf("feature option=\"Resign -check 0\"\n");           // example of an engine-defined option
       printf("feature option=\"Contempt -spin 0 -200 200\"\n"); // and another one
       printf("feature done=1\n");