Add forgotten files 1.4.70b
[polyglot.git] / epd.cpp
diff --git a/epd.cpp b/epd.cpp
index 18c5190..fab728a 100644 (file)
--- a/epd.cpp
+++ b/epd.cpp
@@ -55,6 +55,8 @@ static double LastTime;
 static uint64 LastNodeNb;\r
 static move_t LastPV[LineSize];\r
 \r
+static my_timer_t Timer[1];\r
+\r
 // prototypes\r
 \r
 static void epd_test_file  (const char file_name[]);\r
@@ -211,6 +213,8 @@ static void epd_test_file(const char file_name[]) {
 \r
       // search\r
 \r
+      my_timer_start(Timer); // also resets\r
+      \r
       // which ones of the next two alternatives is best?\r
       engine_send(Engine,"go movetime %.0f depth %d",MaxTime*1000.0,MaxDepth);\r
       //engine_send(Engine,"go infinite");\r
@@ -241,27 +245,23 @@ static void epd_test_file(const char file_name[]) {
 \r
       // parse engine output\r
 \r
-      while (engine_step()) {\r
+      while (!engine_eof(Engine) && engine_step()) {\r
           bool stop=false;\r
-         // stop search?\r
 \r
+         // stop search?\r
+//          printf("Uci->time=%.2f time=%.2f\n",Uci->time,my_timer_elapsed_real(Timer));\r
           if (Uci->depth > MaxDepth){\r
               my_log("POLYGLOT Maximum depth %d reached\n",MaxDepth);\r
               stop=true;\r
-          }else if(Uci->time >= MaxTime){\r
+          }else if(my_timer_elapsed_real(Timer) >= MaxTime){\r
               my_log("POLYGLOT Maximum search time %.2fs reached\n",MaxTime);\r
               stop=true;\r
           }else if(Uci->depth - FirstDepth >= DepthDelta){\r
-              my_log("POLYGLOT DepthDelta (=%d) reached\n",DepthDelta);\r
               if(Uci->depth > MinDepth){\r
-                  my_log("POLYGLOT Minimum depth %d reached\n",MinDepth);\r
                   if(Uci->time >= MinTime){\r
-                      my_log("POLYGLOT Minimum search time %.2fs reached\n",MinTime);\r
                       if(is_solution(FirstMove,board,bm,am)){\r
-                          my_log("POLYGLOT Solution is correct\n");\r
+                          my_log("POLYGLOT Solution found\n",MaxTime);\r
                           stop=true;\r
-                      }else{\r
-                          my_log("POLYGLOT Solution is not correct\n");\r
                       }\r
                   }\r
               }\r
@@ -282,13 +282,13 @@ static void epd_test_file(const char file_name[]) {
       if (correct) {\r
          depth_tot += double(FirstDepth);\r
          time_tot += FirstTime;\r
-         node_tot += double(FirstNodeNb);\r
+         node_tot += double(sint64(FirstNodeNb));\r
       }\r
 \r
       printf("%2d: %-15s %s %4d",tot,id,correct?"OK":"--",hit);\r
 \r
       if (!line_to_san(LastPV,Uci->board,pv_string,StringSize)) ASSERT(false);\r
-      printf(" [at: depth=%2d time=%6.2f nodes="S64_FORMAT"] score=%+6.2f pv=%s\n",FirstDepth,FirstTime,FirstNodeNb,double(LastScore)/100.0,pv_string);\r
+      printf(" score=%+6.2f    pv [D=%2d, T=%7.2fs, N=%6dk] =%s\n",double(LastScore)/100.0,FirstDepth,FirstTime,(int)FirstNodeNb/1000,pv_string);\r
    }\r
 \r
    printf("\nscore=%d/%d",hit,tot);\r