Bump version number to 0.20
[hachu.git] / hachu.c
diff --git a/hachu.c b/hachu.c
index ffde08b..2401644 100644 (file)
--- a/hachu.c
+++ b/hachu.c
@@ -10,7 +10,7 @@
 // promotions by pieces with Lion power stepping in & out the zone in same turn\r
 // promotion on capture\r
 \r
-#define VERSION "0.19"\r
+#define VERSION "0.20"\r
 \r
 //define PATH level==0 || path[0] == 0x590cb &&  (level==1 || path[1] == 0x4c0c9 && (level == 2 || path[2] == 0x8598ca && (level == 3 /*|| path[3] == 0x3e865 && (level == 4 || path[4] == 0x4b865 && (level == 5))*/)))\r
 #define PATH 0\r
@@ -166,7 +166,7 @@ int retMSP, retFirst, retDep, pvPtr, level, cnt50, mobilityScore;
 int ll, lr, ul, ur; // corner squares\r
 int nodes, startTime, lastRootMove, lastRootIter, tlim1, tlim2, tlim3, repCnt, comp, abortFlag;\r
 Move ponderMove;\r
-Move retMove, moveStack[10000], path[100], repStack[300], pv[1000], repeatMove[300], killer[100][2];\r
+Move retMove, moveStack[20000], path[100], repStack[300], pv[1000], repeatMove[300], killer[100][2];\r
 \r
       int maxDepth;                            // used by search\r
 \r
@@ -1057,8 +1057,8 @@ NewNonCapture (int x, int y, int promoFlags)
 {\r
   if(board[y] != EMPTY) return 1; // edge, capture or own piece\r
 //if(flag) printf("# add %c%d%c%d, pf=%d\n", x%BW+'a',x/BW,y%BW+'a',y/BW, promoFlags);\r
-  if( (promoBoard[x] | promoBoard[y]) & promoFlags &&\r
-      (!entryProm || promoBoard[y] & ~promoBoard[x] & CAN_PROMOTE )){ // piece can promote with this move\r
+  if( (entryProm ? promoBoard[y] & ~promoBoard[x] & CAN_PROMOTE\r
+                 : promoBoard[y] |  promoBoard[x]       ) & promoFlags ){ // piece can promote with this move\r
     moveStack[msp++] = moveStack[nonCapts];           // create space for promotion\r
     moveStack[nonCapts++] = x<<SQLEN | y | PROMOTE;   // push promotion\r
     if((promoFlags & promoBoard[y] & (CANT_DEFER | DONT_DEFER | LAST_RANK)) == 0) { // deferral could be a better alternative\r
@@ -2027,6 +2027,7 @@ if(flag & depth >= 0) printf("%2d:%d found %d/%d %08x %s\n", depth, iterDep, cur
 \r
 if(flag & depth >= 0) printf("%2d:%d made %d/%d %s\n", depth, iterDep, curMove, msp, MoveToText(moveStack[curMove], 0));\r
       for(i=2; i<=cnt50; i+=2) if(repStack[level-i+200] == hashKeyH) {\r
+       retDep = iterDep;\r
        if(repDraws) { score = 0; goto repetition; }\r
        if(!allowRep) {\r
          moveStack[curMove] = 0;         // erase forbidden move\r
@@ -2146,7 +2147,7 @@ if(PATH) printf("%d:%2d:%d %3d %6x %-10s %6d %6d  (%d)\n", level, depth, iterDep
 #ifdef HASH\r
     // hash store\r
     hashTable[index].lock[hit]  = hashKeyH;\r
-    hashTable[index].depth[hit] = iterDep;\r
+    hashTable[index].depth[hit] = resDep;\r
     hashTable[index].score[hit] = bestScore;\r
     hashTable[index].flag[hit]  = (bestScore < beta) * H_UPPER;\r
     if(bestScore > alpha) {\r
@@ -2238,7 +2239,7 @@ pmoves(int start, int end)
 \r
     // some parameter of your engine\r
     #define MAXMOVES 2000 /* maximum game length  */\r
-    #define MAXPLY   30   /* maximum search depth */\r
+    #define MAXPLY   60   /* maximum search depth */\r
 \r
     #define OFF 0\r
     #define ON  1\r
@@ -2335,6 +2336,7 @@ Convert (char *fen)
     if(!*fen) break;\r
     fen++;\r
   }\r
+  *p = '\0';\r
   printf("# converted FEN '%s'\n", fenArray);\r
   return fenArray;\r
 }\r