From fce224ff7c02fb416ae9269f7d9ca64f3522adc6 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 10 Aug 2026 17:24:34 +0200 Subject: fixing even more lint warings --- src/bot.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/bot.cpp') diff --git a/src/bot.cpp b/src/bot.cpp index f9ca92f..4682998 100644 --- a/src/bot.cpp +++ b/src/bot.cpp @@ -5,6 +5,7 @@ #include "zobrist.hpp" #include +#include #include #include #include @@ -35,7 +36,7 @@ bool searchStopped = false; static int ScoreMove(const Game *board, const Move &move, const Move *bestMove) { // Indexed by PieceType (NONE, PAWN, KNIGHT, BISHOP, ROOK, QUEEN, KING). - static constexpr int PIECE_VALUES[] = { + static constexpr std::array PIECE_VALUES = { 0, // NONEPIECE 100, // PAWN 320, // KNIGHT @@ -126,7 +127,6 @@ static int quiescenceSearch(Game *b, int qdepth, int alpha, int beta, int ply) { }; return alpha; }; - static int search(int depth, Game *b, int alpha, int beta, int ply) { Nodes++; if ((Nodes & 2047) == 0) { @@ -230,7 +230,10 @@ static SearchResult SearchDepth(Game *b, int depth, const Move *previousBest) { auto moves = GetSortedLegalMoves(b, true, previousBest); if (moves.empty()) { - return {{}, EvaluateBoardForWhite(b)}; + return { + .bestMove = {}, + .score = EvaluateBoardForWhite(b), + }; } Move bestMove = moves[0]; @@ -255,16 +258,14 @@ static SearchResult SearchDepth(Game *b, int depth, const Move *previousBest) { alpha = std::max(alpha, eval); } - return {bestMove, bestEval}; + return {.bestMove = bestMove, .score = bestEval}; } static void PrintInfo(const int depth, const int engineScore, const uint64_t nps) { if (std::abs(engineScore) >= MATE_THRESHOLD) { int movesToMate = (MATE - std::abs(engineScore) + 1) / 2; - if (movesToMate < 1) { - movesToMate = 1; - } + movesToMate = std::max(1, movesToMate); std::cout << "info depth " << depth << " score mate " << (engineScore > 0 ? movesToMate : -movesToMate) << "\n" << std::flush; -- cgit v1.2.3