Add XBoard protocol drivers
[bonanza.git] / utility.c
index 75b1b9a..91f4876 100644 (file)
--- a/utility.c
+++ b/utility.c
@@ -591,6 +591,20 @@ com_turn_start( tree_t * restrict ptree, int flag )
   }
 
   OutCsaShogi( "info tt %03u:%02u\n", sec_total / 60U, sec_total % 60U );
+#ifdef XBOARD
+  { extern char xboard_mode;
+    if(xboard_mode) { // print move in WB format and defuse next line
+      if(str_move[0] < '0' || str_move[0] > '9') Out("\n%s\n# ", str_move); // only resign?
+      else if(str_move[0] == '0')
+        Out("\nmove %c@%c%c\n# ", // drop
+               "PLNSGBR"[(move>>7&127)-nsquare],
+               '9'+'a'-str_move[2], '1'+'9'-str_move[3]);
+      else Out("\n#t=%d tm=%d\nmove %c%c%c%c%s\n# ", time_limit, time_max_limit,
+               '9'+'a'-str_move[0], '1'+'9'-str_move[1],
+               '9'+'a'-str_move[2], '1'+'9'-str_move[3], (move & FLAG_PROMO ? "+" : "="));
+    }
+  }
+#endif
   Out( "%s '(%d%s) %03u:%02u/%03u:%02u  elapsed: b%u, w%u\n",
        str_move, value,
        ( last_pv.type == pv_fail_high ) ? "!" : "",