-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMove.hpp
39 lines (27 loc) · 801 Bytes
/
Move.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef CHESS_ENGINE_MOVE_HPP
#define CHESS_ENGINE_MOVE_HPP
#include "Square.hpp"
#include "Piece.hpp"
#include <iosfwd>
#include <optional>
#include <string>
class Move {
public:
using Optional = std::optional<Move>;
Move(const Square& from, const Square& to,
const std::optional<PieceType>& promotion = std::nullopt);
static Optional fromUci(const std::string& uci);
std::string toUci();
Square from() const;
Square to() const;
std::optional<PieceType> promotion() const;
private:
Square f;
Square t;
std::optional<PieceType> prom;
};
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