-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmoves_io.h
More file actions
32 lines (29 loc) · 1.14 KB
/
moves_io.h
File metadata and controls
32 lines (29 loc) · 1.14 KB
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
#pragma once
#include "fwd_decl.h"
#include <cstdint>
#include <stdexcept>
#include <string>
#include <string_view>
namespace chess::uci {
std::string moveToUci(Move move, bool chess960 = false);
std::string squareToString(Square sq);
class IllegalMoveException : public std::exception {
public:
IllegalMoveException(const std::string &message) : message_(message) {}
const char *what() const noexcept override { return message_.c_str(); }
private:
std::string message_;
};
class AmbiguousMoveException : public std::exception {
public:
AmbiguousMoveException(const std::string &message) : message_(message) {}
const char *what() const noexcept override { return message_.c_str(); }
private:
std::string message_;
};
template <typename T, typename P = void> Move uciToMove(const _Position<T, P> &pos, std::string_view uci);
template <typename T, typename P = void>
Move parseSan(const _Position<T, P> &pos, std::string_view uci, bool remove_illegals = false);
template <typename T, typename P = void>
std::string moveToSan(const _Position<T, P> &pos, Move move, bool long_ = false, bool suffix = true);
} // namespace chess::uci