Implement UCI_PlayByNodes option
authorH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 23 Mar 2015 10:35:29 +0000 (11:35 +0100)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Mon, 23 Mar 2015 10:41:27 +0000 (11:41 +0100)
Polyglot now suppresses passing any option called UCI_PlayByNodes as
CECP option feature. It remembers the option, and uses its presence
to determine whether to handle a received CECP "nps" command by
using "go nodes" calculated from an improvised TC, or to just pass
it as value for UCI_PlayByNodes. Any "new" command would reset
UCI_PlaByNodes to 0.

xboard2uci.c

index 31312e4..4ddb72e 100644 (file)
@@ -391,6 +391,9 @@ void xboard2uci_gui_step(char string[]) {
 
                        XB->depth_limit = FALSE;
             XB->node_rate=-1;
+            if (option_find(Uci->option,"UCI_PlayByNodes")) {
+                uci_send_option(Uci,"UCI_PlayByNodes","%d",0);
+            }
 
                        XB->computer = FALSE;
                        my_string_set(&XB->name,"<empty>");
@@ -428,7 +431,12 @@ void xboard2uci_gui_step(char string[]) {
                                gui_send(GUI,"pong %s",Star[0]);
                        }
         } else if (match(string,"nps *")) {
-            
+
+            if (Star[0] > 0 && option_find(Uci->option,"UCI_PlayByNodes")) {
+
+                uci_send_option(Uci,"UCI_PlayByNodes","%d",Star[0]);
+
+            } else
                 // fake WB play-by-nodes mode
             XB->node_rate = atoi(Star[0]);
                } else if (match(string,"playother")) {
@@ -1022,6 +1030,7 @@ void xboard2uci_send_options(){
     if(my_string_case_equal(opt->name,"UCI_ShredderbasesPath")) continue;
     if(my_string_case_equal(opt->name,"UCI_SetPositionValue")) continue;
     if(my_string_case_equal(opt->name,"UCI_DrawOffers")) continue;
+    if(my_string_case_equal(opt->name,"UCI_PlayByNodes")) continue;
     if(my_string_case_equal(opt->name,"Ponder")) continue;
     if(my_string_case_equal(opt->name,"Hash")) continue;
     if(my_string_case_equal(opt->name,"NalimovPath")) continue;