From efa9959d73c798480252b1e53dd6846c07c10ac9 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 10 Aug 2026 19:56:43 +0200 Subject: fixing more lint warnings --- src/uci.cpp | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/uci.cpp b/src/uci.cpp index b1fc1b7..5303c4b 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -93,14 +93,6 @@ Game initBoard( b.MoveClock = 0; b.Transpositions = transPositions; - Piece EmptyPiece = { - .color = false, - .type = NONEPIECE, - }; - for (int i = 0; i < 64; i++) { - b.pieces[i] = EmptyPiece; - }; - setBoardFen(startingFEN, &b); uint64_t key = GenerateZobristKey(&b); @@ -111,14 +103,14 @@ static void PrintBitboard(uint64_t bb, const std::string &name) { std::cout << name << "\n"; for (int rank = 7; rank >= 0; --rank) { - std::printf("%d | ", 8 - rank); + std::print("{0} | ", rank + 1); for (int file = 0; file < 8; file++) { int sq = (rank * 8) + file; std::cout << (((bb >> sq) & 1ULL) ? "1 " : ". "); } - std::printf(" | %d\n", 8 - rank); + std::print(" | {0}\n", rank + 1); } std::cout << "0x" << std::hex << bb << std::dec << "\n\n"; } @@ -169,6 +161,24 @@ static void printPromotionLetter(PieceType p) { assert(false && "Unexpected promotion type"); } } +static void printBoard(Game *g) { + for (int rank = 7; rank >= 0; --rank) { + std::print("{0} |", rank + 1); + + for (int file = 0; file < 8; file++) { + Piece piece = g->pieces[(rank * 8) + file]; + + if (piece.type == NONEPIECE) { + print(" 00"); + continue; + }; + std::print(" {0}{1}", static_cast(piece.type), + piece.color ? 'W' : 'B'); + } + + std::print(" | {0}\n", rank + 1); + } +} void Uci() { unordered_map transpositions = {}; Game game = initBoard(starting_fen, &transpositions); @@ -178,24 +188,11 @@ void Uci() { LogUci("GUI -> ENGINE: " + cmd); if (cmd == "quit") { + exit(0); break; } if (cmd == "board") { - for (int rank = 7; rank >= 0; --rank) { - std::printf("%d |", 8 - rank); - - for (int file = 0; file < 8; file++) { - Piece piece = game.pieces[(rank * 8) + file]; - - if (piece.type == NONEPIECE) { - print(" 00"); - continue; - }; - std::printf(" %d%c", piece.type, piece.color ? 'W' : 'B'); - } - - std::printf(" | %d\n", 8 - rank); - } + printBoard(&game); } if (cmd == "bits") { DebugBitboards(&game); -- cgit v1.2.3