This commit is contained in:
2022-12-23 23:57:29 +01:00
parent 87adca7e66
commit cb0fcc4702
14 changed files with 208 additions and 52 deletions

View File

@@ -24,19 +24,34 @@ class Piece {
public:
constexpr static const PieceType PromotionTypes[4] = {PieceType::Knight, PieceType::Bishop, PieceType::Rook, PieceType::Queen};
constexpr static const PieceType PromotionTypes[4] = {PieceType::Knight, PieceType::Bishop, PieceType::Rook,
PieceType::Queen};
constexpr static const unsigned PieceValue[6] = {100, 350, 350, 525, 1000, 10000};
constexpr static const unsigned PromotionScore[6] = {0, 26, 36, 46, 56, 0};
constexpr static const unsigned MVV_LVA[6][6] = {
{15, 14, 13, 12, 11, 10}, // Pawn
{25, 24, 23, 22, 21, 20}, // Knight
{35, 34, 33, 32, 31, 30}, // Bishop
{45, 44, 43, 42, 41, 40}, // Rook
{55, 54, 53, 52, 51, 50}, // Queen
{65, 64, 63, 62, 61, 60}, // King
};
using Optional = std::optional<Piece>;
Piece(PieceColor color, PieceType type);
static Optional fromSymbol(char symbol);
static char toSymbol(PieceType type);
static std::optional<PieceType> pieceTypeFromSymbol(char symbol);
PieceColor color() const;
PieceType type() const;
char toSymbol() const;
private:
@@ -45,6 +60,7 @@ private:
};
bool operator==(const Piece &lhs, const Piece &rhs);
std::ostream &operator<<(std::ostream &os, const Piece &piece);
// Invert a color (White becomes Black and vice versa)