@@ -73,8 +73,8 @@ class Fastchess : public IOutput {
7373 }
7474
7575 // engine, engine2, tc, threads, hash, book
76- auto line1 = fmt::format (" Results of {} vs {} ({}, {}, {}{}):" , first, second, tc, threads, hash, book. empty ()
77- ? " " : fmt::format (" , {}" ,bookname));
76+ auto line1 = fmt::format (" Results of {} vs {} ({}, {}, {}{}):" , first, second, tc, threads, hash,
77+ book. empty () ? " " : fmt::format (" , {}" , bookname));
7878 auto line2 = fmt::format (" Elo: {}, nElo: {}" , elo->getElo (), elo->nElo ());
7979 auto line3 =
8080 fmt::format (" LOS: {}, DrawRatio: {}, PairsRatio: {:.2f}" , elo->los (), elo->drawRatio (stats), pairsRatio);
@@ -91,72 +91,47 @@ class Fastchess : public IOutput {
9191 if (sprt.isEnabled ()) {
9292 double llr = sprt.getLLR (stats, report_penta_);
9393
94- std::stringstream ss ;
94+ auto fmt = fmt::format ( " LLR: {:.2f} {} {} \n " , llr, sprt. getBounds (), sprt. getElo ()) ;
9595
96- ss << " LLR: " << std::fixed << std::setprecision (2 ) << llr //
97- << " " << sprt.getBounds () //
98- << " " << sprt.getElo () << " \n " ;
99-
100- std::cout << ss.str () << std::flush;
96+ std::cout << fmt << std::flush;
10197 }
10298 }
10399
104100 void startGame (const pair_config& configs, std::size_t current_game_count, std::size_t max_game_count) override {
105- std::stringstream ss;
106-
107- ss << " Started game " //
108- << current_game_count //
109- << " of " //
110- << max_game_count //
111- << " (" //
112- << configs.first .name //
113- << " vs " //
114- << configs.second .name //
115- << " )" //
116- << " \n " ;
117-
118- std::cout << ss.str () << std::flush;
101+ auto fmt = fmt::format (" Started game {} of {} ({} vs {})\n " , current_game_count, max_game_count,
102+ configs.first .name , configs.second .name );
103+
104+ std::cout << fmt << std::flush;
119105 }
120106
121107 void endGame (const pair_config& configs, const Stats& stats, const std::string& annotation,
122108 std::size_t id) override {
123- std::stringstream ss;
124-
125- ss << " Finished game " //
126- << id //
127- << " (" //
128- << configs.first .name //
129- << " vs " //
130- << configs.second .name //
131- << " ): " //
132- << formatStats (stats) //
133- << " {" //
134- << annotation //
135- << " }" //
136- << " \n " ;
137-
138- std::cout << ss.str () << std::flush;
109+ auto fmt = fmt::format (" Finished game {} ({} vs {}): {} {}\n " , id, configs.first .name , configs.second .name ,
110+ formatStats (stats), annotation);
111+
112+ std::cout << fmt << std::flush;
139113 }
140114
141115 void endTournament () override { std::cout << " Tournament finished" << std::endl; }
142116
143117 private:
144118 std::string getTime (const engine::UciEngine& engine) {
145- if (engine.getConfig ().limit .tc .time > 0 ) {
146- return fmt::format (" {}{:.2g}{}" ,
147- engine.getConfig ().limit .tc .moves > 0
148- ? fmt::format (" {}/" , engine.getConfig ().limit .tc .moves )
149- : " " ,
150- engine.getConfig ().limit .tc .time / 1000.0 ,
151- engine.getConfig ().limit .tc .increment > 0
152- ? fmt::format (" +{:.2g}" , engine.getConfig ().limit .tc .increment / 1000.0 )
153- : " " );
154- } else if (engine.getConfig ().limit .tc .fixed_time > 0 ) {
155- return fmt::format (" {:.2f}/move" , engine.getConfig ().limit .tc .fixed_time / 1000.0 );
156- } else if (engine.getConfig ().limit .plies > 0 ) {
157- return fmt::format (" {} plies" , engine.getConfig ().limit .plies );
158- } else if (engine.getConfig ().limit .nodes > 0 ) {
159- return fmt::format (" {} nodes" , engine.getConfig ().limit .nodes );
119+ const auto & limit = engine.getConfig ().limit ;
120+
121+ if (limit.tc .time > 0 ) {
122+ auto moves = limit.tc .moves > 0 ? fmt::format (" {}/" , limit.tc .moves ) : " " ;
123+ auto time = limit.tc .time / 1000.0 ;
124+ auto increment = limit.tc .increment > 0 ? fmt::format (" +{:.2g}" , limit.tc .increment / 1000.0 ) : " " ;
125+
126+ return fmt::format (" {}{:.2g}{}" , moves, time, increment);
127+ } else if (limit.tc .fixed_time > 0 ) {
128+ auto time = limit.tc .fixed_time / 1000.0 ;
129+
130+ return fmt::format (" {:.2f}/move" , time);
131+ } else if (limit.plies > 0 ) {
132+ return fmt::format (" {} plies" , limit.plies );
133+ } else if (limit.nodes > 0 ) {
134+ return fmt::format (" {} nodes" , limit.nodes );
160135 }
161136
162137 return " " ;
0 commit comments