Add debug printf in ParseMove
[hachu.git] / hachu.c
diff --git a/hachu.c b/hachu.c
index 7a6dccc..8a92ee5 100644 (file)
--- a/hachu.c
+++ b/hachu.c
@@ -1990,6 +1990,7 @@ MapFromScratch(attacks);
     if((moveStack[i] & (PROMOTE | DEFER-1)) == ret) break;\r
     if((moveStack[i] & DEFER-1) == ret) deferred = i; // promoted version of entered non-promotion is legal\r
   }\r
+printf("# moveNr = %d in {%d,%d}\n", i, retFirst, retMSP);\r
   if(i>=retMSP) {  // no exact match\r
     if(deferred) { // but maybe non-sensical deferral\r
       int flags = p[board[f]].promoFlag;\r
@@ -2134,6 +2135,7 @@ printf("# setup done");fflush(stdout);
 \r
         if(stm == engineSide) {         // if it is the engine's turn to move, set it thinking, and let it move\r
      \r
+pboard(board);\r
           score = SearchBestMove(stm, timeLeft, mps, timeControl, inc, timePerMove, &move, &ponderMove);\r
 \r
           if(move == INVALID) {         // game apparently ended\r
@@ -2180,8 +2182,6 @@ printf("# setup done");fflush(stdout);
         // wait for input, and read it until we have collected a complete line\r
         for(i = 0; (inBuf[i] = getchar()) != '\n'; i++);\r
         inBuf[i+1] = 0;\r
-pboard(board);\r
-pmoves(retFirst, retMSP);\r
 \r
         // extract the first word\r
         sscanf(inBuf, "%s", command);\r
@@ -2219,7 +2219,6 @@ printf("in: %s\n", command);
           for(i=0; i<5; i++) {\r
             sscanf(inBuf+8, "%s", command);\r
             if(!strcmp(variants[i].name, command)) {\r
-printf("var %d\n",i);\r
               Init(i); stm = Setup2(NULL); break;\r
             }\r
          }\r
@@ -2265,6 +2264,7 @@ printf("var %d\n",i);
         if(!strcmp(command, ""))  {  continue; }\r
         if(!strcmp(command, "usermove")){\r
           int move = ParseMove(inBuf+9);\r
+pboard(board);\r
           if(move == INVALID) {\r
             if(reason) printf("Illegal move {%s}\n", reason); else printf("%s\n", reason="Illegal move");\r
             if(comp) PrintResult(stm, -INF); // against computer: claim\r