6 Move::Move(const Point
& from
, const Point
& to
, int promotionType
)
10 , m_promotion(promotionType
) { }
14 , m_from(Point::invalid())
15 , m_to(Point::invalid())
20 Point
Move::enPassantTrigger() const {
21 if (m_type
== EN_PASSANT_TRIGGER
) {
22 return (m_from
+ m_to
) / 2;
25 return Point::invalid();
29 Point
Move::captureSquare() const {
30 if (m_type
== EN_PASSANT_CAPTURE
) {
31 return Point(m_to
.x
, m_from
.y
);
38 int Move::promoteTo() const {
39 if (m_type
== PROMOTION
) {
47 bool Move::kingSideCastling() const {
48 return m_type
== KING_SIDE_CASTLING
;
51 bool Move::queenSideCastling() const {
52 return m_type
== QUEEN_SIDE_CASTLING
;
55 Point
Move::from() const {
59 Point
Move::to() const {
63 bool Move::valid() const {
64 return //m_from != Point::invalid() &&
65 m_to
!= Point::invalid() &&
69 void Move::setType(Type type
) {
73 bool Move::operator==(const Move
& move
) const {
74 return m_type
== move
.m_type
&&
75 m_from
== move
.m_from
&&
77 m_promotion
== move
.m_promotion
;
81 } // namespace HLVariant