update
This commit is contained in:
20
Move.hpp
20
Move.hpp
@@ -7,14 +7,17 @@
|
||||
#include <iosfwd>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <limits>
|
||||
|
||||
class Move {
|
||||
public:
|
||||
|
||||
using Optional = std::optional<Move>;
|
||||
|
||||
Move(const Square &from, const Square &to,
|
||||
const std::optional<PieceType> &promotion = std::nullopt);
|
||||
explicit Move(const Square &from, const Square &to);
|
||||
explicit Move(const Square &from, const Square &to,
|
||||
const std::optional<PieceType> &promotion, unsigned score = 0);
|
||||
explicit Move(const Square &from, const Square &to, unsigned score);
|
||||
|
||||
static Optional fromUci(const std::string &uci);
|
||||
|
||||
@@ -22,16 +25,23 @@ public:
|
||||
Square to() const;
|
||||
std::optional<PieceType> promotion() const;
|
||||
|
||||
|
||||
friend bool operator<(const Move &lhs, const Move &rhs);
|
||||
friend bool operator==(const Move &lhs, const Move &rhs);
|
||||
|
||||
private:
|
||||
Square mFrom;
|
||||
Square mTo;
|
||||
std::optional<PieceType> mPromotion;
|
||||
std::optional<PieceType> mPromotion = std::nullopt;
|
||||
unsigned mScore = std::numeric_limits<unsigned>::max();
|
||||
public:
|
||||
unsigned int score() const;
|
||||
|
||||
void setScore(unsigned int mScore);
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const Move &move);
|
||||
|
||||
// Needed for std::map, std::set
|
||||
bool operator<(const Move &lhs, const Move &rhs);
|
||||
bool operator==(const Move &lhs, const Move &rhs);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user