#define BSIZE BWMAX*BHMAX\r
#define ZONE zone\r
\r
-#define ONE (currentVariant == V_SHO || currentVariant == V_CHESS)\r
+#define ONE (currentVariant == V_SHO || currentVariant == V_CHESS || currentVariant == V_SHATRANJ)\r
\r
#define BLACK 0\r
#define WHITE 1\r
{ NULL } // sentinel\r
};\r
\r
+PieceDesc shatranjPieces[] = {\r
+ {"Q", "", 15, { 0,1,0,1,0,1,0,1 } },\r
+ {"R", "", 50, { X,0,X,0,X,0,X,0 } },\r
+ {"B", "", 9, { 0,J,0,J,0,J,0,J } },\r
+ {"N", "", 30, { N,N,N,N,N,N,N,N } },\r
+ {"K", "", 28, { 1,1,1,1,1,1,1,1 } },\r
+ {"P", "Q", 8, { M,C,0,0,0,0,0,C } },\r
+ { NULL } // sentinel\r
+};\r
+\r
char chuArray[] = "L:FLCSGK:DEGSC:FLL/:RV.B.:BT:KN:PH:BT.B.:RV/:SM:VMR:DH:DK:LN:FK:DK:DHR:VM:SM/PPPPPPPPPPPP/...:GB....:GB..."\r
"/............/............/"\r
"...:gb....:gb.../pppppppppppp/:sm:vmr:dh:dk:fk:ln:dk:dhr:vm:sm/:rv.b.:bt:ph:kn:bt.b.:rv/l:flcsg:dekgsc:fll";\r
":ss:vsb:dh:dk:wb:fi:fe:lh:fi:wb:dk:dhb:vs:ss/:rv.:cs:cs.:bt:ph:fk:ln:kn:bt.:cs:cs.:rv/ln:flicsg:dekgsci:flnl";\r
char shoArray[] = "LNSGKGSNL/.B..:DE..R./PPPPPPPPP/........./........./........./ppppppppp/.r..:de..b./lnsgkgsnl";\r
char chessArray[] = "RNBQKBNR/PPPPPPPP/......../......../......../......../pppppppp/rnbqkbnr";\r
+char shatArray[]= "RNBKQBNR/PPPPPPPP/......../......../......../......../pppppppp/rnbkqbnr";\r
\r
typedef struct {\r
int boardWidth, boardFiles, boardRanks, zoneDepth, varNr; // board sizes\r
char *array; // initial position\r
} VariantDesc;\r
\r
-typedef enum { V_CHESS, V_SHO, V_CHU, V_DAI, V_TENJIKU, V_DADA, V_MAKA, V_TAI, V_KYOKU } Variant;\r
+typedef enum { V_CHESS, V_SHO, V_CHU, V_DAI, V_TENJIKU, V_DADA, V_MAKA, V_TAI, V_KYOKU, V_SHATRANJ } Variant;\r
\r
VariantDesc variants[] = {\r
{ 16, 8, 8, 1, V_CHESS, "normal", chessArray }, // FIDE\r
{ 24, 12, 12, 4, V_CHU, "chu", chuArray }, // Chu\r
{ 30, 15, 15, 5, V_DAI, "dai", daiArray }, // Dai\r
{ 32, 16, 16, 5, V_TENJIKU, "tenjiku", tenArray }, // Tenjiku\r
+ { 16, 8, 8, 1, V_SHATRANJ,"shatranj",shatArray}, // Shatranj\r
+\r
// { 0, 0, 0, 0, 0 }, // sentinel\r
{ 34, 17, 17, 0, V_DADA, "dada", chuArray }, // Dai Dai\r
{ 38, 19, 19, 0, V_MAKA, "maka", chuArray }, // Maka Dai Dai\r
return ListLookUp(name, chuPieces);\r
case V_CHESS: // FIDE\r
return ListLookUp(name, chessPieces);\r
+ case V_SHATRANJ: // Shatranj\r
+ return ListLookUp(name, shatranjPieces);\r
}\r
return NULL;\r
}\r
}\r
}\r
for(i=stm+2; i<last[stm]; i+=2) { // second pass: promoted pieces\r
+\r
if((k = p[i].promo) == -2 && p[i].pos == ABSENT) { // orphaned promoted piece not present\r
SqueezeOut(i);\r
}\r
char c, *q, name[3];\r
PieceDesc *p1, *p2;\r
last[WHITE] = 1; last[BLACK] = 0;\r
- if(var == V_CHESS) // add dummy Crown Princes\r
+ if(var == V_CHESS || var == V_SHATRANJ) // add dummy Crown Princes\r
p[AddPiece(WHITE, LookUp("CP", V_CHU))].pos = p[AddPiece(BLACK, LookUp("CP", V_CHU))].pos = ABSENT;\r
for(i=0; ; i++) {\r
//printf("next rank: %s\n", array);\r
if(isalpha(*fen)) {\r
char *table = fenNames;\r
n = *fen > 'Z' ? 'a' - 'A' : 0;\r
- if(currentVariant == V_CHESS && *fen - 'A' - n == 'N' // In Chess N is Knight, not Lion\r
+ if((currentVariant == V_CHESS || currentVariant == V_SHATRANJ) && *fen - 'A' - n == 'N' // In Chess N is Knight, not Lion\r
|| table[2* (*fen - 'A' - n)] == '.') *p++ = *fen; else {\r
*p++ = ':';\r
*p++ = table[2* (*fen - 'A' - n)] + n;\r
}\r
if(!strcmp(command, "protover")){\r
printf("feature ping=1 setboard=1 colors=0 usermove=1 memory=1 debug=1 sigint=0 sigterm=0\n");\r
- printf("feature variants=\"normal,chu,dai,tenjiku,12x12+0_fairy,9x9+0_shogi\"\n");\r
+ printf("feature variants=\"normal,shatranj,chu,dai,tenjiku,12x12+0_fairy,9x9+0_shogi\"\n");\r
printf("feature myname=\"HaChu " VERSION "\" highlight=1\n");\r
printf("feature option=\"Resign -check 0\"\n"); // example of an engine-defined option\r
printf("feature option=\"Contempt -spin 0 -200 200\"\n"); // and another one\r