uci->root_move = MoveNone;\r
uci->root_move_pos = 0;\r
uci->root_move_nb = board_mobility(uci->board);\r
+\r
+ uci->multipvSP=0;\r
}\r
\r
// uci_send_isready()\r
ASSERT(!my_string_empty(argument));\r
\r
n = atoi(argument);\r
- if(Uci->multipv_mode) multipvline=n;\r
+ multipvline=n;\r
\r
ASSERT(n>=1);\r
\r
\r
parse_close(parse);\r
\r
- // update display\r
- //lousy uci,filter out lower depth multipv lines that have been repeated from the engine \r
- if(multipvline>1 && uci->depth<uci->best_depth) event &= ~EVENT_PV;\r
+\r
+ // code by HGM\r
if ((event & EVENT_PV) != 0) {\r
uci->best_score = uci->score; \r
- uci->best_depth = uci->depth;\r
- if(multipvline==1)uci->depth=-1; //HACK ,clears the engine outpout window,see send_pv in adapter.cpp \r
uci->best_sel_depth = uci->sel_depth;\r
line_copy(uci->best_pv,uci->pv);\r
}\r
+ if(uci->depth < uci->best_depth){\r
+ // ignore lines of lower depth\r
+ event &= ~EVENT_PV;\r
+ } else {\r
+ if(uci->depth > uci->best_depth) {\r
+ // clear stack when we start new depth\r
+ uci->multipvSP = 0; \r
+ }\r
+ uci->best_depth = uci->depth;\r
+ if(multipvline >= 1) {\r
+ int i;\r
+ for(i=0; i<uci->multipvSP; i++) {\r
+ if(uci->score == uci->multipvScore[i] && uci->pv[0] == uci->multipvMove[i]) {\r
+ event &= ~EVENT_PV; // ignore duplicates\r
+ }\r
+ }\r
+ if(event & EVENT_PV){\r
+ // line is new, try to add to stack\r
+ if(uci->multipvSP<MultiPVStackSize){\r
+ uci->multipvMove[uci->multipvSP] = uci->pv[0];\r
+ uci->multipvScore[uci->multipvSP] = uci->score;\r
+ uci->multipvSP++;\r
+ }else{\r
+ my_fatal("parse_info(): multipv stack overflow.");\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+\r
return event;\r
}\r
\r