diff options
| author | Adam <adammegarules1@gmail.com> | 2026-08-10 19:56:43 +0200 |
|---|---|---|
| committer | Adam <adammegarules1@gmail.com> | 2026-08-10 19:56:43 +0200 |
| commit | efa9959d73c798480252b1e53dd6846c07c10ac9 (patch) | |
| tree | 22d26a203569ce72003166e5c75adade90aa5c5b | |
| parent | bc5d459f25b0d9e5e36cbd42c16699fbece4c407 (diff) | |
fixing more lint warnings
| -rw-r--r-- | src/uci.cpp | 47 |
1 files changed, 22 insertions, 25 deletions
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<int>(piece.type), + piece.color ? 'W' : 'B'); + } + + std::print(" | {0}\n", rank + 1); + } +} void Uci() { unordered_map<uint64_t, TranspositionsEntry> 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); |
