From db72cf783cdcceafca37e1d968d06925462e51fe Mon Sep 17 00:00:00 2001 From: Calcitem Date: Sun, 14 Nov 2021 01:36:27 +0800 Subject: [PATCH] cpp: Add username to TODO comment --- include/config.h | 2 +- src/evaluate.cpp | 2 +- src/hashmap.h | 2 +- src/mills.cpp | 2 +- src/movepick.cpp | 2 +- src/position.cpp | 10 +++++----- src/search.cpp | 11 +++++------ src/thread.cpp | 4 ++-- src/uci.cpp | 10 ++++++++-- src/ui/qt/client.h | 2 +- src/ui/qt/game.cpp | 4 ++-- src/ui/qt/gamewindow.cpp | 4 ++-- src/ui/qt/server.cpp | 2 +- 13 files changed, 31 insertions(+), 26 deletions(-) diff --git a/include/config.h b/include/config.h index 3793db81..d8aa5253 100644 --- a/include/config.h +++ b/include/config.h @@ -49,7 +49,7 @@ #define UCI_AUTO_RE_GO #endif -// Play via network (TODO: Port to Qt 6) +// Play via network (TODO(calcitem): Port to Qt 6) //#define NET_FIGHT_SUPPORT /// Qt simple GUI like a mobile app (WIP) diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 8d787c7f..e6e14a30 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -136,7 +136,7 @@ Value Evaluation::value() piece_on_board_count_future_white -= pos.piece_to_remove_count(); } - // TODO: flyPieceCount? + // TODO(calcitem): flyPieceCount? if (piece_on_board_count_future_black == 3 || piece_on_board_count_future_white == 3) { if (abs(value) < VALUE_KNOWN_WIN) { value = VALUE_DRAW; diff --git a/src/hashmap.h b/src/hashmap.h index 5b2949ee..e249ae5b 100644 --- a/src/hashmap.h +++ b/src/hashmap.h @@ -160,7 +160,7 @@ public: void resize(size_t size) { - // TODO: Resize + // TODO(calcitem): Resize if (size < 0x1000000) { // New size is too small, do not resize return; diff --git a/src/mills.cpp b/src/mills.cpp index b875270d..17f1c464 100644 --- a/src/mills.cpp +++ b/src/mills.cpp @@ -373,7 +373,7 @@ void mill_table_init() void move_priority_list_shuffle() { if (gameOptions.getSkillLevel() == 1) { - for (auto i = 8; i < 32; i++) { // TODO: SQ_BEGIN & SQ_END + for (auto i = 8; i < 32; i++) { // TODO(calcitem): SQ_BEGIN & SQ_END MoveList::movePriorityList[i - int(SQ_BEGIN)] = (Square)i; } if (gameOptions.getShufflingEnabled()) { diff --git a/src/movepick.cpp b/src/movepick.cpp index b3224164..26bf1879 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -64,7 +64,7 @@ void MovePicker::score() ourMillsCount = pos.potential_mills_count(to, pos.side_to_move(), from); #ifndef SORT_MOVE_WITHOUT_HUMAN_KNOWLEDGES - // TODO: rule.mayRemoveMultiple adapt other rules + // TODO(calcitem): rule.mayRemoveMultiple adapt other rules if (type_of(m) != MOVETYPE_REMOVE) { // all phrase, check if place sq can close mill if (ourMillsCount > 0) { diff --git a/src/position.cpp b/src/position.cpp index d40a6f26..83525fd0 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -620,7 +620,7 @@ bool Position::put_piece(Square s, bool updateRecord) const Piece pc = board[s] = piece; byTypeBB[ALL_PIECES] |= byTypeBB[type_of(pc)] |= s; - byColorBB[color_of(pc)] |= s; // TODO: Put ban? + byColorBB[color_of(pc)] |= s; // TODO(calcitem): Put ban? update_key(s); @@ -805,7 +805,7 @@ bool Position::remove_piece(Square s, bool updateRecord) Piece pc = board[s]; - CLEAR_BIT(byTypeBB[type_of(pc)], s); // TODO: rule.hasBannedLocations and placing need? + CLEAR_BIT(byTypeBB[type_of(pc)], s); // TODO(calcitem): rule.hasBannedLocations and placing need? CLEAR_BIT(byColorBB[color_of(pc)], s); updateMobility(MOVETYPE_REMOVE, s); @@ -823,7 +823,7 @@ bool Position::remove_piece(Square s, bool updateRecord) if (updateRecord) { snprintf(record, RECORD_LEN_MAX, "-(%1u,%1u)", file_of(s), rank_of(s)); - st.rule50 = 0; // TODO: Need to move out? + st.rule50 = 0; // TODO(calcitem): Need to move out? } pieceOnBoardCount[them]--; @@ -1011,7 +1011,7 @@ bool Position::check_if_game_is_over() set_gameover(~sideToMove, GameOverReason::loseReasonNoWay); return true; } else { - change_side_to_move(); // TODO: Need? + change_side_to_move(); // TODO(calcitem): Need? return false; } } @@ -1021,7 +1021,7 @@ bool Position::check_if_game_is_over() int Position::calculate_mobility_diff() { - // TODO: Deal with rule is no ban location + // TODO(calcitem): Deal with rule is no ban location int mobilityWhite = 0; int mobilityBlack = 0; diff --git a/src/search.cpp b/src/search.cpp index f309bb49..ea4e1e6e 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -21,7 +21,6 @@ using Eval::evaluate; using std::string; -using namespace Search; Value MTDF(Position* pos, Sanmill::Stack& ss, Value firstguess, Depth depth, Depth originDepth, Move& bestMove); @@ -117,7 +116,7 @@ int Thread::search() MoveList::shuffle(); #if 0 - // TODO: Only NMM + // TODO(calcitem): Only NMM if (rootPos->piece_on_board_count(WHITE) + rootPos->piece_on_board_count(BLACK) <= 1 && !rule.hasDiagonalLines && gameOptions.getShufflingEnabled()) { const uint32_t seed = static_cast(now()); @@ -301,8 +300,8 @@ Value qsearch(Position* pos, Sanmill::Stack& ss, Depth depth, Depth or // process leaves // Check for aborted search - // TODO: and immediate draw - if (unlikely(pos->phase == Phase::gameOver) || // TODO: Deal with hash + // TODO(calcitem): and immediate draw + if (unlikely(pos->phase == Phase::gameOver) || // TODO(calcitem): Deal with hash depth <= 0 || Threads.stop.load(std::memory_order_relaxed)) { bestValue = Eval::evaluate(*pos); @@ -337,10 +336,10 @@ Value qsearch(Position* pos, Sanmill::Stack& ss, Depth depth, Depth or } #if 0 - // TODO: Weak + // TODO(calcitem): Weak if (bestMove != MOVE_NONE) { for (int i = 0; i < moveCount; i++) { - if (mp.moves[i].move == bestMove) { // TODO: need to write value? + if (mp.moves[i].move == bestMove) { // TODO(calcitem): need to write value? std::swap(mp.moves[0], mp.moves[i]); break; } diff --git a/src/thread.cpp b/src/thread.cpp index e3f62f07..87430334 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -83,7 +83,7 @@ Thread::~Thread() void Thread::clear() noexcept { - // TODO: Reset histories + // TODO(calcitem): Reset histories return; } @@ -428,7 +428,7 @@ string Thread::next_move() if (bestvalue <= -VALUE_KNOWN_WIN) { Endgame endgame; endgame.type = rootPos->side_to_move() == WHITE ? EndGameType::blackWin : EndGameType::whiteWin; - Key endgameHash = rootPos->key(); // TODO: Do not generate hash repeatedly + Key endgameHash = rootPos->key(); // TODO(calcitem): Do not generate hash repeatedly saveEndgameHash(endgameHash, endgame); } } diff --git a/src/uci.cpp b/src/uci.cpp index 0ba3faeb..c4e922f4 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -25,7 +25,13 @@ #include "command_channel.h" #endif -using namespace std; +using std::cin; +using std::istream; +using std::istringstream; +using std::skipws; +using std::string; +using std::stringstream; +using std::vector; extern vector setup_bench(Position*, istream&); @@ -78,7 +84,7 @@ void position(Position* pos, istringstream& is) } } - // TODO: Stockfish does not have this + // TODO(calcitem): Stockfish does not have this Threads.main()->us = pos->sideToMove; } diff --git a/src/ui/qt/client.h b/src/ui/qt/client.h index adbe3c0a..477b3326 100644 --- a/src/ui/qt/client.h +++ b/src/ui/qt/client.h @@ -73,7 +73,7 @@ private: QDataStream in; QString currentAction; - // TODO: 'QNetworkSession': was declared deprecated + // TODO(calcitem): 'QNetworkSession': was declared deprecated QNetworkSession* networkSession = nullptr; uint16_t port {}; diff --git a/src/ui/qt/game.cpp b/src/ui/qt/game.cpp index 561c7cc5..82906a6c 100644 --- a/src/ui/qt/game.cpp +++ b/src/ui/qt/game.cpp @@ -95,7 +95,7 @@ Game::Game( #endif // QT_GUI_LIB #ifdef NET_FIGHT_SUPPORT - server = new Server(nullptr, 30001); // TODO: WARNING: ThreadSanitizer: data race + server = new Server(nullptr, 30001); // TODO(calcitem): WARNING: ThreadSanitizer: data race uint16_t clientPort = server->getPort() == 30001 ? 30002 : 30001; client = new Client(nullptr, clientPort); @@ -367,7 +367,7 @@ void Game::setInvert(bool arg) } } -void Game::setRule(int ruleNo, int stepLimited /*= -1*/, int timeLimited /*= 0 TODO: Unused */) +void Game::setRule(int ruleNo, int stepLimited /*= -1*/, int timeLimited /*= 0 TODO(calcitem): Unused */) { rule.nMoveRule = stepLimited; diff --git a/src/ui/qt/gamewindow.cpp b/src/ui/qt/gamewindow.cpp index 1707aa3c..29b00c20 100644 --- a/src/ui/qt/gamewindow.cpp +++ b/src/ui/qt/gamewindow.cpp @@ -550,7 +550,7 @@ void MillGameWindow::on_actionLimited_T_triggered() label_step->setText(tr("N-Move Rule:")); - // TODO: Save settings + // TODO(calcitem): Save settings //comboBox_step->addItem(tr("Infinite"), 0); comboBox_step->addItem(tr("10 Moves"), 10); comboBox_step->addItem(tr("30 Moves"), 30); @@ -587,7 +587,7 @@ void MillGameWindow::on_actionLimited_T_triggered() int dStep = comboBox_step->currentData().toInt(); int dTime = comboBox_time->currentData().toInt(); if (gStep != dStep || gTime != dTime) { - game->setRule(ruleNo, static_cast(dStep), dTime); // TODO: Remove dTime + game->setRule(ruleNo, static_cast(dStep), dTime); // TODO(calcitem): Remove dTime game->setMoveTime(dTime); } } diff --git a/src/ui/qt/server.cpp b/src/ui/qt/server.cpp index 149eed09..d845e996 100644 --- a/src/ui/qt/server.cpp +++ b/src/ui/qt/server.cpp @@ -159,7 +159,7 @@ void Server::sessionOpened() void Server::setAction(const QString& a) { - // TODO: WAR + // TODO(calcitem): WAR if (actions.size() > 256) { while (!actions.empty()) { actions.pop();