X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=searchr.c;h=216967d095f0830a2a4fb84f6cf4664c6bf62b2c;hb=6186adc13f7366b1ad78355b2693f2fa8269dd9e;hp=3afd2aa99c91986d41f774862788e505aaafbef4;hpb=31daebfc1031441aa180e3af2e547a8cd2b92c32;p=bonanza.git diff --git a/searchr.c b/searchr.c index 3afd2aa..216967d 100644 --- a/searchr.c +++ b/searchr.c @@ -24,6 +24,10 @@ static int CONV next_root_move( tree_t * restrict ptree ); static int CONV next_root_move( tree_t * restrict ptree, int turn ); #endif +#ifdef XBOARD +extern char xboard_mode; +#endif + static int CONV search_wrapper( tree_t * restrict ptree, int alpha, int beta, int turn, int depth, int ply, unsigned int state_node ) @@ -351,6 +355,9 @@ out_pv( tree_t * restrict ptree, int value, int turn, unsigned int time ) if ( ptree->pv[0].length ) { +#ifdef XBOARD + if(xboard_mode) Out("%2d %6d %6d %8d ", iteration_depth, value, time/10, 1); else +#endif if ( root_move_list[root_index].status & flag_first ) { Out( " %2d %6s %7.2f ", iteration_depth, str, dvalue ); @@ -361,6 +368,17 @@ out_pv( tree_t * restrict ptree, int value, int turn, unsigned int time ) for ( ply = 1; ply <= ptree->pv[0].length; ply++ ) { +#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) ? "+" : "=" : ""); + } else +#endif if ( is_out ) { if ( ply > 1 && ! ( (ply-1) % 5 ) ) @@ -407,6 +425,17 @@ out_pv( tree_t * restrict ptree, int value, int turn, unsigned int time ) for ( i = 1; i < ply; i++ ) if ( ptree->pv[0].a[i] == ptree->pv[0].a[ply] ) { goto rep_esc; } +#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) ? "+" : "=" : ""); + } else +#endif if ( is_out ) { if ( ply > 1 && ! ( (ply-1) % 5 ) ) @@ -546,6 +575,9 @@ next_root_move( tree_t * restrict ptree, int turn ) root_index = i; #if ! ( defined(NO_STDOUT) && defined(NO_LOGGING) ) +#ifdef XBOARD + if(!xboard_mode) +#endif if ( iteration_depth > 5 ) { const char *str_move;