refactor: Rename to enum piece_t

This commit is contained in:
CalciteM Team 2019-09-13 11:59:09 +08:00
parent 0c672eadd2
commit f75b316e67
4 changed files with 9 additions and 9 deletions

View File

@ -22,7 +22,7 @@
#include "position.h"
static const hash_t zobrist0[Board::N_LOCATIONS][POINT_TYPE_COUNT] = {
static const hash_t zobrist0[Board::N_LOCATIONS][PIECE_TYPE_COUNT] = {
#ifdef TRANSPOSITION_TABLE_CUTDOWN
{0x4E421A00, 0x3962FF00, 0x6DB6EE00, 0x219AE100},
{0x1F3DE200, 0xD9AACB00, 0xD5173300, 0xD3F9EA00},

View File

@ -1179,7 +1179,7 @@ void Position::constructHash()
context.hash = 0;
#include "zobrist.h"
memcpy(context.zobrist, zobrist0, sizeof(hash_t) * Board::N_LOCATIONS * POINT_TYPE_COUNT);
memcpy(context.zobrist, zobrist0, sizeof(hash_t) * Board::N_LOCATIONS * PIECE_TYPE_COUNT);
}
hash_t Position::getHash()

View File

@ -45,7 +45,7 @@ public:
hash_t hash{};
// Zobrist 数组
hash_t zobrist[Board::N_LOCATIONS][POINT_TYPE_COUNT]{};
hash_t zobrist[Board::N_LOCATIONS][PIECE_TYPE_COUNT]{};
// 局面阶段标识
enum phase_t phase;

View File

@ -52,13 +52,13 @@ enum MoveDirection
};
// 棋盘点上棋子的类型
enum PointType : uint16_t
enum piece_t : uint16_t
{
POINT_TYPE_EMPTY = 0, // 没有棋子
POINT_TYPE_PLAYER1 = 1, // 先手的子
POINT_TYPE_PLAYER2 = 2, // 后手的子
POINT_TYPE_FORBIDDEN = 3, // 禁点
POINT_TYPE_COUNT = 4
PIECE_EMPTY = 0, // 没有棋子
PIECE_PLAYER_1 = 1, // 先手的子
PIECE_PLAYER_2 = 2, // 后手的子
PIECE_FORBIDDEN = 3, // 禁点
PIECE_TYPE_COUNT = 4
};
// 玩家标识, 轮流状态, 胜负标识