@@ -271,7 +271,7 @@ enum class MoveType { kKiller, kGood };
271271
272272// Structs
273273
274- struct Board { // 28B
274+ struct Board { // 172B
275275 std::uint64_t white[6 ]{}; // White bitboards
276276 std::uint64_t black[6 ]{}; // Black bitboards
277277 std::int32_t score{0 }; // Sorting score
@@ -280,9 +280,9 @@ struct Board { // 28B
280280 std::uint8_t index{0 }; // Sorting index
281281 std::uint8_t from{0 }; // From square
282282 std::uint8_t to{0 }; // To square
283- std::uint8_t type{0 }; // Move type (0: Normal, 1: OOw, 2: OOOw, 3: OOb, 4: OOOb, 5: =n, 6: =b, 7: =r, 8: =q )
284- std::uint8_t castle{0 }; // Castling rights (0x1: K, 0x2: Q, 0x4: k, 0x8: q )
285- std::uint8_t fifty{0 }; // Rule 50 counter
283+ std::uint8_t type{0 }; // Move type ( 0: Normal 1:OOw 2:OOOw 3:OOb 4:OOOb 5:=n 6:=b 7:=r 8:=q )
284+ std::uint8_t castle{0 }; // Castling rights ( 0x1:K 0x2:Q 0x4:k 0x8:q )
285+ std::uint8_t fifty{0 }; // Rule 50 counter ( 256 max )
286286
287287 const std::string movename () const ;
288288 bool is_underpromo () const ;
@@ -408,7 +408,7 @@ char PromoLetter(const std::int8_t piece) {
408408}
409409
410410extern " C" {
411- // See if cin has smt
411+ // See if std:: cin has smt
412412bool InputAvailable () {
413413#ifdef WINDOWS
414414 return _kbhit ();
@@ -2026,19 +2026,19 @@ bool FastMove(const int ms) {
20262026}
20272027
20282028void SearchRootMoves (const bool is_eg) {
2029- auto good = 0 ; // Good score in a row for HCE activation
2030- const auto now = Now ();
2029+ auto good = 0 ; // Good score in a row for HCE activation
2030+ const auto start = Now ();
20312031
20322032 for ( ; std::abs (g_best_score) != INF && g_depth < g_max_depth && !g_stop_search; ++g_depth) {
20332033 g_q_depth = std::min (g_q_depth + 2 , MAX_Q_DEPTH);
20342034 g_best_score = g_wtm ? BestW () : BestB ();
20352035 // Switch to classical only when the game is decided ( 4+ pawns ) !
20362036 g_classical = g_classical || (is_eg && std::abs (g_best_score) > (4 * 100 ) && ((++good) >= 7 ));
2037- SpeakUci (g_best_score, Now () - now );
2037+ SpeakUci (g_best_score, Now () - start );
20382038 }
20392039
20402040 g_last_eval = g_best_score;
2041- if (!g_q_depth) SpeakUci (g_last_eval, Now () - now ); // Nothing searched -> Print smt for UCI
2041+ if (!g_q_depth) SpeakUci (g_last_eval, Now () - start ); // Nothing searched -> Print smt for UCI
20422042}
20432043
20442044void ThinkReset () { // Reset search status
@@ -2142,15 +2142,13 @@ void UciGoInfinite() {
21422142
21432143void UciGoMovetime () {
21442144 Think (std::max (0 , TokenNumber ()));
2145- TokenPop ();
21462145 PrintBestMove ();
21472146}
21482147
21492148void UciGoDepth () {
21502149 g_max_depth = std::clamp (TokenNumber (), 1 , MAX_DEPTH);
21512150 Think (WEEK);
21522151 g_max_depth = MAX_DEPTH;
2153- TokenPop ();
21542152 PrintBestMove ();
21552153}
21562154
@@ -2166,9 +2164,9 @@ void UciGo() {
21662164 else if (Token (" winc" )) { winc = std::max (0 , TokenNumber ()); }
21672165 else if (Token (" binc" )) { binc = std::max (0 , TokenNumber ()); }
21682166 else if (Token (" movestogo" )) { mtg = std::max (1 , TokenNumber ()); }
2169- else if (Token (" movetime" )) { UciGoMovetime (); return ; }
2170- else if (Token (" infinite" )) { UciGoInfinite (); return ; }
2171- else if (Token (" depth" )) { UciGoDepth (); return ; }
2167+ else if (Token (" movetime" )) { UciGoMovetime (), TokenPop () ; return ; }
2168+ else if (Token (" infinite" )) { UciGoInfinite (); return ; }
2169+ else if (Token (" depth" )) { UciGoDepth (), TokenPop () ; return ; }
21722170
21732171 g_wtm ? Think (std::min (wtime, wtime / mtg + winc)) :
21742172 Think (std::min (btime, btime / mtg + binc));
@@ -2221,9 +2219,9 @@ void UciPerft(const std::string &d, const std::string &fen) {
22212219 MgenRoot ();
22222220 for (auto i = 0 ; i < g_root_n; ++i) {
22232221 g_board = g_boards[0 ] + i;
2224- const auto now = Now ();
2222+ const auto start = Now ();
22252223 const auto nodes2 = depth >= 0 ? Perft (!g_wtm, depth - 1 , 1 ) : 0 ;
2226- const auto ms = Now () - now ;
2224+ const auto ms = Now () - start ;
22272225 std::cout << (i + 1 ) << " . " << g_boards[0 ][i].movename () << " -> " << nodes2 << " (" << ms << " ms)" << std::endl;
22282226 nodes += nodes2;
22292227 total_ms += ms;
@@ -2248,9 +2246,9 @@ void UciBench(const std::string &d, const std::string &t, const std::string &h,
22482246 for (const auto &fen : kBench ) {
22492247 std::cout << " [ " << (++n) << " /" << kBench .size () << " ; " << fen << " ]" << std::endl;
22502248 Fen (fen);
2251- const auto now = Now ();
2249+ const auto start = Now ();
22522250 Think (time);
2253- total_ms += Now () - now ;
2251+ total_ms += Now () - start ;
22542252 nodes += g_nodes;
22552253 std::cout << std::endl;
22562254 }
0 commit comments