From ca6bbb491a60257272cbcb0e1c969e8a3043dd6b Mon Sep 17 00:00:00 2001 From: Calcitem Date: Sun, 5 Jul 2020 22:17:37 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=5FselectPiece=20=E6=94=B9=E5=90=8D?= =?UTF-8?q?=E4=B8=BA=20select=5Fpiece?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ai/movegen.cpp | 2 +- src/game/position.cpp | 6 +++--- src/game/position.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ai/movegen.cpp b/src/ai/movegen.cpp index 0a9fe30b..03f19bfd 100644 --- a/src/ai/movegen.cpp +++ b/src/ai/movegen.cpp @@ -337,7 +337,7 @@ ExtMove *generateMoves(/* TODO: const */ Position *position, ExtMove *moveList) for (int i = Board::MOVE_PRIORITY_TABLE_SIZE - 1; i >= 0; i--) { oldSquare = static_cast(MoveList::movePriorityTable[i]); - if (!position->_selectPiece(oldSquare)) { + if (!position->select_piece(oldSquare)) { continue; } diff --git a/src/game/position.cpp b/src/game/position.cpp index 556427ec..59209960 100644 --- a/src/game/position.cpp +++ b/src/game/position.cpp @@ -472,7 +472,7 @@ out: return true; } -bool Position::_selectPiece(Square square) +bool Position::select_piece(Square square) { if (phase != PHASE_MOVING) return false; @@ -492,7 +492,7 @@ bool Position::_selectPiece(Square square) bool Position::_selectPiece(File file, Rank rank) { - return _selectPiece(Board::polarToSquare(file, rank)); + return select_piece(Board::polarToSquare(file, rank)); } bool Position::giveup(Color loser) @@ -602,7 +602,7 @@ bool Position::do_move(Move m) case MOVETYPE_REMOVE: return remove_piece(static_cast(-m)); case MOVETYPE_MOVE: - if (_selectPiece(from_sq(m))) { + if (select_piece(from_sq(m))) { return place_piece(to_sq(m)); } break; diff --git a/src/game/position.h b/src/game/position.h index c58c5e39..698da3b6 100644 --- a/src/game/position.h +++ b/src/game/position.h @@ -73,7 +73,7 @@ public: Position &operator=(const Position &) = delete; // Properties of moves - bool _selectPiece(Square s); + bool select_piece(Square s); bool place_piece(Square s, bool updateCmdlist = false); bool remove_piece(Square s, bool updateCmdlist = false);