// promotions by pieces with Lion power stepping in & out the zone in same turn\r
// promotion on capture\r
\r
-#define VERSION "0.5beta"\r
+#define VERSION "0.6beta"\r
\r
#define PATH level==0 || path[0] == 0xc4028 && (level==1 /*|| path[1] == 0x75967 && (level == 2 || path[2] == 0x3400b && (level == 3))*/)\r
//define PATH 0\r
#define BSIZE BWMAX*BHMAX\r
#define ZONE zone\r
\r
-#define ONE (currentVariant == V_SHO || currentVariant == V_CHESS || currentVariant == V_SHATRANJ)\r
+#define ONE (currentVariant == V_SHO || currentVariant == V_CHESS || currentVariant == V_SHATRANJ || currentVariant == V_MAKRUK)\r
\r
#define BLACK 0\r
#define WHITE 1\r
{ NULL } // sentinel\r
};\r
\r
+PieceDesc makrukPieces[] = {\r
+ {"SM","", 15, { 0,1,0,1,0,1,0,1 } },\r
+ {"R", "", 50, { X,0,X,0,X,0,X,0 } },\r
+ {"S", "", 20, { 1,1,0,1,0,1,0,1 } }, // silver\r
+ {"N", "", 30, { N,N,N,N,N,N,N,N } },\r
+ {"K", "", 28, { 1,1,1,1,1,1,1,1 } },\r
+ {"P", "SM", 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
char shoArray[] = "LNSGKGSNL/.B..:DE..R./PPPPPPPPP/........./........./........./ppppppppp/.r..:de..b./lnsgkgsnl";\r
char chessArray[] = "RNBQKBNR/PPPPPPPP/......../......../......../......../pppppppp/rnbqkbnr";\r
char shatArray[]= "RNBK:FKBNR/PPPPPPPP/......../......../......../......../pppppppp/rnbk:fkbnr";\r
+char thaiArray[]= "RNSK:SMSNR/......../PPPPPPPP/......../......../pppppppp/......../rnsk:smsnr";\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, V_SHATRANJ } Variant;\r
+typedef enum { V_CHESS, V_SHO, V_CHU, V_DAI, V_TENJIKU, V_DADA, V_MAKA, V_TAI, V_KYOKU, V_SHATRANJ, V_MAKRUK } Variant;\r
\r
VariantDesc variants[] = {\r
{ 16, 8, 8, 1, V_CHESS, "normal", chessArray }, // FIDE\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
+ { 16, 8, 8, 3, V_MAKRUK, "makruk", thaiArray}, // Makruk\r
\r
// { 0, 0, 0, 0, 0 }, // sentinel\r
{ 34, 17, 17, 0, V_DADA, "dada", chuArray }, // Dai Dai\r
return ListLookUp(name, chessPieces);\r
case V_SHATRANJ: // Shatranj\r
return ListLookUp(name, shatranjPieces);\r
+ case V_MAKRUK: // Makruk\r
+ return ListLookUp(name, makrukPieces);\r
}\r
return NULL;\r
}\r
char c, *q, name[3];\r
PieceDesc *p1, *p2;\r
last[WHITE] = 1; last[BLACK] = 0;\r
- if(var == V_CHESS || var == V_SHATRANJ) // add dummy Crown Princes\r
+ if(var == V_CHESS || var == V_SHATRANJ || var == V_MAKRUK) // 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
chuFlag = (currentVariant == V_CHU);\r
tenFlag = (currentVariant == V_TENJIKU);\r
chessFlag = (currentVariant == V_CHESS);\r
- repDraws = (currentVariant == V_CHESS || currentVariant == V_SHATRANJ);\r
+ repDraws = (currentVariant == V_CHESS || currentVariant == V_SHATRANJ || currentVariant == V_MAKRUK);\r
\r
for(i= -1; i<9; i++) { // board steps in linear coordinates\r
kStep[i] = STEP(direction[i&7].x, direction[i&7].y); // King\r
if(isalpha(*fen)) {\r
char *table = fenNames;\r
n = *fen > 'Z' ? 'a' - 'A' : 0;\r
- if((currentVariant == V_CHESS || currentVariant == V_SHATRANJ) && *fen - n == 'N' // In Chess N is Knight, not Lion\r
+ if((currentVariant == V_CHESS || currentVariant == V_SHATRANJ || currentVariant == V_MAKRUK) && *fen - 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
static char buf[50];\r
int f = move>>SQLEN & SQUARE, g = f, t = move & SQUARE;\r
+ char *promoChar = "";\r
if(f == t) { sprintf(buf, "@@@@"); return buf; } // null-move notation in WB protocol\r
buf[0] = '\0';\r
if(t >= SPECIAL) { // kludgy! Print as side effect non-standard WB command to remove victims from double-capture (breaks hint command!)\r
}\r
t = g + toList[t - SPECIAL];\r
}\r
- sprintf(buf+strlen(buf), "%c%d%c%d%s", f%BW+'a', f/BW+ONE, t%BW+'a', t/BW+ONE, move & PROMOTE ? "+" : "");\r
+ if(move & PROMOTE) promoChar = currentVariant == V_MAKRUK ? "m" : repDraws ? "q" : "+";\r
+ sprintf(buf+strlen(buf), "%c%d%c%d%s", f%BW+'a', f/BW+ONE, t%BW+'a', t/BW+ONE, promoChar);\r
return buf;\r
}\r
\r
t2 = SPECIAL + 8*i + j;\r
}\r
ret = f<<SQLEN | t2;\r
- if(*moveText == '+') ret |= PROMOTE;\r
+ if(*moveText != '\n' && *moveText != '=') ret |= PROMOTE;\r
printf("# suppress = %c%d\n", sup1%BW+'a', sup1/BW);\r
MapFromScratch(attacks);\r
postThinking--; repCnt = 0;\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,shatranj,chu,dai,tenjiku,12x12+0_fairy,9x9+0_shogi\"\n");\r
+ printf("feature variants=\"normal,shatranj,makruk,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
continue;\r
}\r
if(!strcmp(command, "variant")) {\r
- for(i=0; i<6; i++) {\r
+ for(i=0; i<7; i++) {\r
sscanf(inBuf+8, "%s", command);\r
if(!strcmp(variants[i].name, command)) {\r
Init(curVarNr = i); stm = Setup2(NULL); break;\r