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 ++++++++------- src/evaluate.cpp | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src') 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; diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 9120445..b1fc4f1 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -22,7 +22,7 @@ static std::array PAWN_TABLE = { 0, 0, 0, 25, 25, 0, 0, 0, // 5, -5, -10, 0, 0, -10, -5, 5, // 5, 10, 10, -20, -20, 10, 10, 5, // - 0, 0, 0, 0, 0, 0, 0, 0 // + 0, 0, 0, 0, 0, 0, 0, 0, // }; static std::array KNIGHT_TABLE = { -- cgit v1.2.3