static int mpv_find_min( int *pnum );
static int mpv_add_result( tree_t * restrict ptree, int value );
static void mpv_sub_result( unsigned int move );
-static void mpv_out( tree_t * restrict ptree, int turn, unsigned int time );
+static void mpv_out( tree_t * restrict ptree, int turn, unsigned int time, int newest );
#endif
#if defined(NO_STDOUT) && defined(NO_LOGGING)
}
+#ifdef XBOARD
+void
+out_xboard_move( int move, int tt )
+{
+ int from = I2From(move), to = I2To(move);
+ char inPromoZone = tt > 0 ? from >= 6*9 || to >= 6*9 : to < 3*9|| from < 3*9;
+ if(from >= nsquare)
+ Out(" %c@%c%c", "PLNSGBR"[From2Drop(from)-1], 'a'+to%9, '9'-to/9);
+ else
+ Out(" %c%c%c%c%s", 'a'+from%9, '9'-from/9, 'a'+to%9, '9'-to/9,
+ inPromoZone ? I2IsPromote(move) ? "+" : "=" : "");
+}
+#endif
+
+
void
out_pv( tree_t * restrict ptree, int value, int turn, unsigned int time )
{
{
#ifdef XBOARD
if(xboard_mode && is_out) { // print PV move in WB format
- int move = ptree->pv[0].a[ply], from = I2From(move), to = I2To(move);
- char inPromoZone = tt > 0 ? from >= 6*9 || to >= 6*9 : to < 3*9|| from < 3*9;
- if(from >= nsquare)
- Out(" %c@%c%c", "PLNSGBR"[From2Drop(from)-1], 'a'+to%9, '9'-to/9);
- else
- Out(" %c%c%c%c%s", 'a'+from%9, '9'-from/9, 'a'+to%9, '9'-to/9,
- inPromoZone ? I2IsPromote(move) ? "+" : "=" : "");
+ out_xboard_move( ptree->pv[0].a[ply], tt );
} else
#endif
if ( is_out )
#ifdef XBOARD
if(xboard_mode && is_out) { // print PV move in WB format
- int move = ptree->pv[0].a[ply], from = I2From(move), to = I2To(move);
- char inPromoZone = tt > 0 ? from >= 6*9 || to >= 6*9 : to < 3*9|| from < 3*9;
- if(from >= nsquare)
- Out(" %c@%c%c", "PLNSGBR"[From2Drop(from)-1], 'a'+to%9, '9'-to/9);
- else
- Out(" %c%c%c%c%s", 'a'+from%9, '9'-from/9, 'a'+to%9, '9'-to/9,
- inPromoZone ? I2IsPromote(move) ? "+" : "=" : "");
+ out_xboard_move( ptree->pv[0].a[ply], tt );
} else
#endif
if ( is_out )
#if defined(MPV)
static void
-mpv_out( tree_t * restrict ptree, int turn, unsigned int time )
+mpv_out( tree_t * restrict ptree, int turn, unsigned int time, int newest )
{
int mpv_out, ipv, best;
str = str_time_symple( time );
ply = mpv_pv[ipv].depth;
+#ifdef XBOARD
+ if(xboard_mode) {
+ if(ipv != newest) continue; // skip all but the newest, to prevent duplicates
+ Out("%2d %6d %6d %8d ", ply, value, time/10, 1);
+ } else
+#endif
if ( ! ipv ) { Out( "o%2d %6s %7.2f ", ply, str, dvalue ); }
else { Out( " %2d %7.2f ", ply, dvalue ); }
}
for ( ply = 1; ply <= mpv_pv[ipv].length; ply++ )
{
+#ifdef XBOARD
+ if(xboard_mode && is_out) { // print PV move in WB format
+ out_xboard_move( mpv_pv[ipv].a[ply], tt );
+ } else
+#endif
if ( is_out )
{
if ( ply > 1 && ! ( (ply-1) % 4 ) )
if ( mpv_pv[ipv].a[i]
== mpv_pv[ipv].a[ply] ) { goto rep_esc; }
+#ifdef XBOARD
+ if(xboard_mode && is_out) { // print PV move in WB format
+ out_xboard_move( mpv_pv[ipv].a[ply], tt );
+ } else
+#endif
if ( is_out )
{
if ( ply > 1 && ! ( (ply-1) % 4 ) )
{
pv_t pv_tmp, pv;
unsigned int time;
- int i, vmin, num;
+ int i, vmin, num, new_pv;
vmin = mpv_find_min( &num );
assert( num <= mpv_num );
pv = ptree->pv[1];
pv.a[0] = (unsigned int)(value+32768);
+ new_pv = i; // [HGM] xboard: remember which is the new one, so we can print only that
do {
assert( i < mpv_num*2 );
assert( i < root_nmove*2 );
if ( get_elapsed( &time ) < 0 ) { return -1; }
- mpv_out( ptree, root_turn, time - time_start );
+ mpv_out( ptree, root_turn, time - time_start, new_pv );
return 1;
}