{ 7, 7, 6, 2, "torishogi\n", toriIDs, toriFEN, toriDirs, toriProms, toriCodes, toriValues },
};
+#define TORI_NR 6 /* must correspond to index of torishogi (which must be last) in table above! */
+
// info per piece type. sometimes indexed by negated holdings count instead of piece
#define pieceKey (rawKey+1)
#define PST (rawPST+1)
// determine variant parameters
if(sscanf(name, "%dx%d+%d_%c", &f, &r, &i, &c) == 4) {
- for(v=6; --v>0; ) if(variants[v].files == f && variants[v].ranks == r && variants[v].hand == i) break;
+ for(v=TORI_NR; --v>0; ) if(variants[v].files == f && variants[v].ranks == r && variants[v].hand == i) break;
} else
- for(v=6; --v>0;) if(!strcmp(name, variants[v].name)) break;
-printf("# variant %d: %s\n", v, variants[v].name);
+ for(v=TORI_NR; --v>0;) if(!strcmp(name, variants[v].name)) break;
nrFiles = variants[v].files;
nrRanks = variants[v].ranks;
zone = variants[v].zone;
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 == 6 ? 0xFF2C : 0xFF1F); // rays along which pinning is possible
+ pinCodes = (v == TORI_NR ? 0xFF2C : 0xFF1F); // rays along which pinning is possible
}
void
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 < 6) { // Shogi variant with Lance
+ else if(perpLoses < TORI_NR) { // 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)
}
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 == 6) score = -INF; // Tori Shogi, repeating loses
+ else if(perpLoses == TORI_NR) score = -INF; // Tori Shogi, repeating loses
}
}