22 for (
movenum_t moveid = 1; moveid <= n_moves; ++moveid) {
49 auto getSiblings = [m](bBoard
const& bs) ->
movelist_t {
53 for (
movenum_t moveid = 1; moveid <= n_moves; ++moveid) {
55 if (bm.
to() == m.
to()) {
57 && (bs.getPiece(bm.
from()) == bs.getPiece(m.
from()))) {
59 siblings.push_back(bm);
65 alternatives = getSiblings(b);
70 m_move = (bCase(m.
from()).operator std::string()).substr(0,1);
76 m_move += bCase(m.
to()).operator std::string();
83 if (alternatives.size() > 0) {
86 if (std::none_of(alternatives.begin(), alternatives.end(),
88 { return bm.fromcolumn() == m.fromcolumn(); })) {
90 m_move.insert(1, (bCase(m.
from()).operator std::string()).substr(0, 1));
91 }
else if (std::none_of(alternatives.begin(), alternatives.end(),
93 { return bm.fromrank() == m.fromrank(); })) {
95 m_move.insert(1, (bCase(m.
from()).operator std::string()).substr(1, 1));
98 m_move.insert(1, (bCase(m.
from()).operator std::string()));
110 if (!m_move.size())
throw std::logic_error(
"empty bPgnMove");
116std::string
const bPgnMove::getPromotionDecorationStr(
ppiece_t const piece)
128 throw std::logic_error(
"superfluous call to bPgnMove::getPromotionDecorationStr");
138 for (
movenum_t moveid = 1; moveid <= n_moves; ++moveid) {
139 bPgnMove pm(b, ml[moveid].getBMoveT());
140 m_pmoves.push_back(pm);
147 for (
bPgnMove const& m: mpl.m_pmoves) {
This is the main include file, needs to be included before any other include.
constexpr piece_t getPiece(case_t const cf) const
constexpr bool isLongCastleMove() const
constexpr bool isCastleMove() const
constexpr bool isCapture() const
constexpr ppiece_t getPromotion() const
constexpr case_t to() const
constexpr bool isPromotion() const
constexpr bool isCheck() const
constexpr case_t from() const
constexpr bool isDrawScore() const
std::string getMoveEvalStr() const
bool isMateMove() const
Check if end of game flag is set, and not forced draw.
movenum_t generateMoves(bBasicBoard const &b)
generate moves if not yet generated
constexpr movenum_t getNumberOfMoves() const
PgnMove is for user-interface only.
std::string const & getMoveEvalStr() const
bPgnMove(bPgnMove const &pm) noexcept
static const std::string getPieceStrUpper(piece_t const piece)
static class member function
std::vector< bMove > movelist_t
std::string to_string(int16_t value)
std::to_string not compatible on Mac OS (Apple LLVM version 5.0) provide generic utility function
std::ostream & operator<<(std::ostream &os, bPgnMoveList const &mpl)