diff --git a/src/ai/movepick.cpp b/src/ai/movepick.cpp
index 0fdf50b4..dd14e21f 100644
--- a/src/ai/movepick.cpp
+++ b/src/ai/movepick.cpp
@@ -155,9 +155,9 @@ void MovePicker::score()
}
#ifdef HOSTORY_HEURISTIC
-score_t MovePicker::getHistoryScore(Move move)
+Score MovePicker::getHistoryScore(Move move)
{
- score_t ret = 0;
+ Score ret = 0;
if (move < 0) {
#ifndef HOSTORY_HEURISTIC_ACTION_MOVE_ONLY
@@ -181,9 +181,9 @@ void MovePicker::setHistoryScore(Move move, Depth depth)
}
#ifdef HOSTORY_HEURISTIC_SCORE_HIGH_WHEN_DEEPER
- score_t score = 1 << (32 - depth);
+ Score score = 1 << (32 - depth);
#else
- score_t score = 1 << depth;
+ Score score = 1 << depth;
#endif
if (move < 0) {
diff --git a/src/ai/movepick.h b/src/ai/movepick.h
index 9709a42a..b9bb3532 100644
--- a/src/ai/movepick.h
+++ b/src/ai/movepick.h
@@ -45,11 +45,11 @@ public:
#ifdef HOSTORY_HEURISTIC
// TODO: Fix size
- score_t placeHistory[64];
- score_t removeHistory[64];
- score_t moveHistory[10240];
+ Score placeHistory[64];
+ Score removeHistory[64];
+ Score moveHistory[10240];
- score_t getHistoryScore(Move move);
+ Score getHistoryScore(Move move);
void setHistoryScore(Move move, Depth depth);
void clearHistoryScore();
#endif // HOSTORY_HEURISTIC
diff --git a/src/game/board.cpp b/src/game/board.cpp
index 69f934bb..426140c3 100644
--- a/src/game/board.cpp
+++ b/src/game/board.cpp
@@ -208,7 +208,7 @@ player_t Board::locationToPlayer(Square square)
int Board::inHowManyMills(Square square, player_t player, Square squareSelected)
{
int n = 0;
- location_t locbak = SQ_0;
+ Location locbak = SQ_0;
if (player == PLAYER_NOBODY) {
player = locationToPlayer(square);
diff --git a/src/game/board.h b/src/game/board.h
index c7485ee0..4d64980a 100644
--- a/src/game/board.h
+++ b/src/game/board.h
@@ -106,7 +106,7 @@ public:
判断棋子是先手的用 (locations[square] & 0x10)
判断棋子是后手的用 (locations[square] & 0x20)
*/
- location_t locations[SQUARE_NB]{};
+ Location locations[SQUARE_NB]{};
Bitboard byTypeBB[PIECE_TYPE_NB];
diff --git a/src/game/position.cpp b/src/game/position.cpp
index da53bc31..9ced0f24 100644
--- a/src/game/position.cpp
+++ b/src/game/position.cpp
@@ -766,7 +766,7 @@ bool Position::command(const char *cmd)
{
int r;
unsigned t;
- step_t s;
+ Step s;
File r1, r2;
Rank s1, s2;
int args = 0;
@@ -1033,7 +1033,7 @@ bool Position::checkGameOverCondition(int8_t updateCmdlist)
int Position::getMobilityDiff(player_t turn, int piecesOnBoard[], bool includeFobidden)
{
// TODO: 处理规则无禁点的情况
- location_t *locations = board.locations;
+ Location *locations = board.locations;
int mobilityBlack = 0;
int mobilityWhite = 0;
int diff = 0;
@@ -1190,7 +1190,7 @@ Key Position::updateKey(Square square)
// 0b00 表示空白,0b01 = 1 表示先手棋子,0b10 = 2 表示后手棋子,0b11 = 3 表示禁点
int pieceType = Player::toId(board.locationToPlayer(square));
// TODO: 标准写法应该是如下的写法,但目前这么写也可以工作
- //location_t loc = board.locations[square];
+ //Location loc = board.locations[square];
//int pieceType = loc == 0x0f? 3 : loc >> PLAYER_SHIFT;
// 清除或者放置棋子
diff --git a/src/game/position.h b/src/game/position.h
index 7f345b00..3ae1525d 100644
--- a/src/game/position.h
+++ b/src/game/position.h
@@ -91,9 +91,9 @@ public:
bool setPosition(const struct Rule *rule);
// 获取棋盘数据
- location_t *getBoardLocations() const
+ Location *getBoardLocations() const
{
- return (location_t *)board.locations;
+ return (Location *)board.locations;
}
// 获取当前棋子位置点
@@ -297,7 +297,7 @@ private:
player_t winner;
// 当前步数
- step_t currentStep{};
+ Step currentStep{};
// 从走子阶段开始或上次吃子起的步数
int moveStep{};
diff --git a/src/game/rule.h b/src/game/rule.h
index e86649ec..c9bf3a9c 100644
--- a/src/game/rule.h
+++ b/src/game/rule.h
@@ -64,7 +64,7 @@ struct Rule
bool allowFlyWhenRemainThreePieces;
// 最大步数,超出判和
- step_t maxStepsLedToDraw;
+ Step maxStepsLedToDraw;
// 包干最长时间(秒),超出判负,为0则不计时
int maxTimeLedToLose;
diff --git a/src/game/types.h b/src/game/types.h
index 70f95d97..92d2828e 100644
--- a/src/game/types.h
+++ b/src/game/types.h
@@ -17,14 +17,14 @@
along with this program. If not, see .
*/
-#ifndef TYPES_H
-#define TYPES_H
+#ifndef TYPES_H_INCLUDED
+#define TYPES_H_INCLUDED
#include "config.h"
-using step_t = uint16_t;
-using location_t = uint8_t;
-using score_t = uint32_t;
+using Step = uint16_t;
+using Location = uint8_t;
+using Score = uint32_t;
//using Bitboard = uint32_t;
typedef uint32_t Bitboard;
@@ -357,4 +357,4 @@ constexpr Move make_move(Square from, Square to)
return Move((from << 8) + to);
}
-#endif /* TYPES_H */
+#endif // #ifndef TYPES_H_INCLUDED
diff --git a/src/ui/qt/gamecontroller.cpp b/src/ui/qt/gamecontroller.cpp
index cb5f8ae8..c3eee558 100644
--- a/src/ui/qt/gamecontroller.cpp
+++ b/src/ui/qt/gamecontroller.cpp
@@ -313,7 +313,7 @@ void GameController::setInvert(bool arg)
#endif // TRAINING_MODE
}
-void GameController::setRule(int ruleNo, step_t stepLimited /*= -1*/, int timeLimited /*= -1*/)
+void GameController::setRule(int ruleNo, Step stepLimited /*= -1*/, int timeLimited /*= -1*/)
{
// 更新规则,原限时和限步不变
if (ruleNo < 0 || ruleNo >= N_RULES)
@@ -1137,7 +1137,7 @@ bool GameController::updateScence()
bool GameController::updateScence(StateInfo &g)
{
#ifndef TRAINING_MODE
- const location_t *board = g.position->getBoardLocations();
+ const Location *board = g.position->getBoardLocations();
QPointF pos;
// game类中的棋子代码
diff --git a/src/ui/qt/gamecontroller.h b/src/ui/qt/gamecontroller.h
index 0203c7fb..30bd4f2f 100644
--- a/src/ui/qt/gamecontroller.h
+++ b/src/ui/qt/gamecontroller.h
@@ -171,7 +171,7 @@ signals:
public slots:
// 设置规则
- void setRule(int ruleNo, step_t stepLimited = std::numeric_limits::max(), int timeLimited = -1);
+ void setRule(int ruleNo, Step stepLimited = std::numeric_limits::max(), int timeLimited = -1);
// 游戏开始
void gameStart();
@@ -434,7 +434,7 @@ private:
int timeLimit;
// 规则限步数
- step_t stepsLimit;
+ Step stepsLimit;
// 玩家剩余时间(秒)
time_t remainingTime[COLOR_COUNT];
diff --git a/src/ui/qt/gamewindow.cpp b/src/ui/qt/gamewindow.cpp
index b70d7719..21f60ea9 100644
--- a/src/ui/qt/gamewindow.cpp
+++ b/src/ui/qt/gamewindow.cpp
@@ -551,7 +551,7 @@ void MillGameWindow::on_actionLimited_T_triggered()
int dTime = comboBox_time->currentData().toInt();
if (gStep != dStep || gTime != dTime) {
// 重置游戏规则
- gameController->setRule(ruleNo, static_cast(dStep), dTime);
+ gameController->setRule(ruleNo, static_cast(dStep), dTime);
}
}