@@ -99,7 +99,14 @@ Match::Match(const book::Opening& opening)
9999 const auto move = uci::moveToUci (opening_move, board_.chess960 ());
100100 board_.makeMove <true >(opening_move);
101101
102- return MoveData (move, " 0.00" , 0 , 0 , 0 , 0 , 0 , true , true );
102+ MoveData move_data;
103+
104+ move_data.move = move;
105+ move_data.score_string = " 0.00" ;
106+ move_data.book = true ;
107+ move_data.legal = true ;
108+
109+ return move_data;
103110 };
104111
105112 std::transform (opening_.moves .begin (), opening_.moves .end (), std::back_inserter (data_.moves ), insert_move);
@@ -120,7 +127,12 @@ std::string Match::convertScoreToString(int score, engine::ScoreType score_type)
120127void Match::addMoveData (const Player& player, int64_t measured_time_ms, int64_t latency, int64_t timeleft, bool legal) {
121128 const auto move = player.engine .bestmove ().value_or (" <none>" );
122129
123- MoveData move_data = MoveData (move, " 0.00" , measured_time_ms, 0 , 0 , 0 , 0 , legal);
130+ MoveData move_data;
131+
132+ move_data.move = move;
133+ move_data.score_string = " 0.00" ;
134+ move_data.elapsed_millis = measured_time_ms;
135+ move_data.legal = legal;
124136
125137 if (player.engine .output ().size () <= 1 ) {
126138 data_.moves .push_back (move_data);
@@ -133,10 +145,10 @@ void Match::addMoveData(const Player& player, int64_t measured_time_ms, int64_t
133145 const auto info = player.engine .lastInfo ();
134146
135147 move_data.nps = str_utils::findElement<uint64_t >(info, " nps" ).value_or (0 );
136- move_data.hashfull = str_utils::findElement<int >(info, " hashfull" ).value_or (0 );
148+ move_data.hashfull = str_utils::findElement<int64_t >(info, " hashfull" ).value_or (0 );
137149 move_data.tbhits = str_utils::findElement<uint64_t >(info, " tbhits" ).value_or (0 );
138- move_data.depth = str_utils::findElement<int >(info, " depth" ).value_or (0 );
139- move_data.seldepth = str_utils::findElement<int >(info, " seldepth" ).value_or (0 );
150+ move_data.depth = str_utils::findElement<int64_t >(info, " depth" ).value_or (0 );
151+ move_data.seldepth = str_utils::findElement<int64_t >(info, " seldepth" ).value_or (0 );
140152 move_data.nodes = str_utils::findElement<uint64_t >(info, " nodes" ).value_or (0 );
141153 move_data.pv = str_utils::join (extractPvFromInfo (info).value_or (std::vector<std::string>{}), " " );
142154 move_data.score = player.engine .lastScore ();
@@ -541,35 +553,39 @@ void Match::verifyPvLines(const Player& us) {
541553
542554 const auto illegal_move = std::find (moves.begin (), moves.end (), uci::uciToMove (board, move)) == moves.end ();
543555
544- if (gameover || illegal_move) {
545- std::string warning;
546- if (illegal_move) {
547- warning = " Warning; Illegal PV move - move {} from {}" ;
548- } else if (gameoverResult.first == GameResultReason::THREEFOLD_REPETITION) {
549- warning = " Warning; PV continues after threefold repetition - move {} from {}" ;
550- } else if (gameoverResult.first == GameResultReason::FIFTY_MOVE_RULE) {
551- warning = " Warning; PV continues after fifty-move rule - move {} from {}" ;
552- } else if (gameoverResult.first == GameResultReason::CHECKMATE) {
553- warning = " Warning; PV continues after checkmate - move {} from {}" ;
554- } else if (gameoverResult.first == GameResultReason::STALEMATE) {
555- warning = " Warning; PV continues after stalemate - move {} from {}" ;
556- }
556+ if (!gameover && !illegal_move) {
557+ board.makeMove <true >(uci::uciToMove (board, move));
558+ continue ;
559+ }
557560
558- assert (!warning. empty ());
561+ // illegal move or gameover reached
559562
560- auto out = fmt::format (fmt::runtime (warning), move, name);
561- auto uci_info = fmt::format (" Info; {}" , info);
562- auto position = fmt::format (" Position; {}" , startpos == " startpos" ? " startpos" : (" fen " + startpos));
563- auto moves = fmt::format (" Moves; {}" , str_utils::join (uci_moves, " " ));
563+ std::string warning;
564564
565- auto separator = config::TournamentConfig->test_env ? " :: " : " \n " ;
565+ if (illegal_move) {
566+ warning = " Warning; Illegal PV move - move {} from {}" ;
567+ } else if (gameoverResult.first == GameResultReason::THREEFOLD_REPETITION) {
568+ warning = " Warning; PV continues after threefold repetition - move {} from {}" ;
569+ } else if (gameoverResult.first == GameResultReason::FIFTY_MOVE_RULE) {
570+ warning = " Warning; PV continues after fifty-move rule - move {} from {}" ;
571+ } else if (gameoverResult.first == GameResultReason::CHECKMATE) {
572+ warning = " Warning; PV continues after checkmate - move {} from {}" ;
573+ } else if (gameoverResult.first == GameResultReason::STALEMATE) {
574+ warning = " Warning; PV continues after stalemate - move {} from {}" ;
575+ }
566576
567- Logger::print<Logger::Level::WARN>( " {1}{0}{2}{0}{3}{0}{4} " , separator, out, uci_info, position, moves );
577+ assert (!warning. empty () );
568578
569- break ;
570- }
579+ auto out = fmt::format (fmt::runtime (warning), move, name);
580+ auto uci_info = fmt::format (" Info; {}" , info);
581+ auto position = fmt::format (" Position; {}" , startpos == " startpos" ? " startpos" : (" fen " + startpos));
582+ auto moves = fmt::format (" Moves; {}" , str_utils::join (uci_moves, " " ));
583+
584+ auto separator = config::TournamentConfig->test_env ? " :: " : " \n " ;
585+
586+ Logger::print<Logger::Level::WARN>(" {1}{0}{2}{0}{3}{0}{4}" , separator, out, uci_info, position, moves);
571587
572- board. makeMove < true >( uci::uciToMove (board, move)) ;
588+ break ;
573589 }
574590 };
575591
@@ -674,6 +690,7 @@ std::string Match::convertChessReason(const std::string& color, GameResultReason
674690 return Match::FIFTY_MSG;
675691 }
676692
693+ assert (false && " Unhandled GameResultReason in convertChessReason" );
677694 return " " ;
678695}
679696
0 commit comments