Give King neutral PST
[hachu.git] / hachu.c
diff --git a/hachu.c b/hachu.c
index 9bc797c..68e0674 100644 (file)
--- a/hachu.c
+++ b/hachu.c
@@ -92,8 +92,8 @@ typedef struct {
 } UndoInfo;\r
 \r
 char *array, fenArray[4000], *reason;\r
-int bWidth, bHeight, bsize, zone, currentVariant;\r
-int stm, xstm, hashKeyH, hashKeyL, framePtr, msp, nonCapts, rootEval, retMSP, retFirst, retDep, pvPtr, level, cnt50, chuFlag=1, tenFlag, mobilityScore;\r
+int bWidth, bHeight, bsize, zone, currentVariant, chuFlag, tenFlag, chessFlag;\r
+int stm, xstm, hashKeyH, hashKeyL, framePtr, msp, nonCapts, rootEval, retMSP, retFirst, retDep, pvPtr, level, cnt50, mobilityScore;\r
 int nodes, startTime, tlim1, tlim2, repCnt, comp;\r
 Move retMove, moveStack[10000], path[100], repStack[300], pv[1000], repeatMove[300];\r
 \r
@@ -676,7 +676,7 @@ AddPiece (int stm, PieceDesc *list)
     if(p[j].promo >= i) p[j].promo += 2;\r
   }\r
   if(royal[stm] >= i) royal[stm] += 2;\r
-  if(p[i].value == (currentVariant == V_SHO ? 410 : 280) ) royal[stm] = i;\r
+  if(p[i].value == (currentVariant == V_SHO ? 410 : 280) ) royal[stm] = i, p[i].pst = 0;\r
   p[i].qval = (currentVariant == V_TENJIKU ? list->ranking : 0); // jump-capture hierarchy\r
   return i;\r
 }\r
@@ -760,6 +760,7 @@ Init (int var)
   bsize = bWidth*bHeight;\r
   chuFlag = (currentVariant == V_CHU);\r
   tenFlag = (currentVariant == V_TENJIKU);\r
+  chessFlag = (currentVariant == V_CHESS);\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
@@ -945,8 +946,8 @@ GenNonCapts (int promoSuppress)
          }\r
        } else\r
        if(r == M) { // FIDE Pawn; check double-move\r
-         if(!NewNonCapture(x, x+v, pFlag) && promoBoard[x-v])\r
-           NewNonCapture(x, x+2*v+DEFER, pFlag); // use promoSuppress flag as e.p. flag\r
+         if(!NewNonCapture(x, x+v, pFlag) && chessFlag && promoBoard[x-v])\r
+           NewNonCapture(x, x+2*v, pFlag), moveStack[msp-1] |= DEFER; // use promoSuppress flag as e.p. flag\r
        }\r
        continue;\r
       }\r
@@ -2232,7 +2233,7 @@ printf("in: %s\n", command);
           continue;\r
         }\r
         if(!strcmp(command, "variant")) {\r
-          for(i=0; i<5; i++) {\r
+          for(i=0; i<6; i++) {\r
             sscanf(inBuf+8, "%s", command);\r
             if(!strcmp(variants[i].name, command)) {\r
               Init(i); stm = Setup2(NULL); break;\r