[Move] Initial implementation

This commit is contained in:
2022-12-18 18:23:05 +01:00
parent d9ed8e498d
commit b282a6e494
2 changed files with 12 additions and 11 deletions

View File

@@ -2,11 +2,8 @@
#include <ostream>
Move::Move(const Square &from, const Square &to,
const std::optional<PieceType> &promotion) {
(void) from;
(void) to;
(void) promotion;
Move::Move(const Square &from, const Square &to, const std::optional<PieceType> &promotion)
: mFrom(from), mTo(to), mPromotion(promotion) {
}
Move::Optional Move::fromUci(const std::string &uci) {
@@ -15,15 +12,15 @@ Move::Optional Move::fromUci(const std::string &uci) {
}
Square Move::from() const {
return Square::A1;
return mFrom;
}
Square Move::to() const {
return Square::A1;
return mTo;
}
std::optional<PieceType> Move::promotion() const {
return std::nullopt;
return mPromotion;
}
std::ostream &operator<<(std::ostream &os, const Move &move) {
@@ -38,7 +35,7 @@ bool operator<(const Move &lhs, const Move &rhs) {
}
bool operator==(const Move &lhs, const Move &rhs) {
(void) lhs;
(void) rhs;
return false;
return lhs.from() == rhs.from()
&& lhs.to() == rhs.to()
&& lhs.promotion() == rhs.promotion();
}