Belofte version 2.1.9
A promising chess program using the UCI or Winboard interface
move.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------+
2 * File: move.h
3 * Project: part of belofte - A Promising Chess Program
4 * Author: yves
5 * SPDX-License-Identifier: GPL-2.0-only
6+----------------------------------------------------------------------*/
7
8#if !defined(MOVE_H)
9#define MOVE_H
10
11//-----------------------------------------------------------------------
12
13class bMove : public bBasicMove {
14public:
15 explicit bMove()
16 : bBasicMove{}
17 {}
18 bMove(bMove const& m)
19 : bBasicMove{m}
20 , m_score{m.m_score}
21 {}
22 explicit bMove(bMove&& m)
23 : bBasicMove{std::move(m)}
24 , m_score{std::move(m.m_score)}
25 {}
26 explicit bMove(case_t cf, case_t ct)
27 : bBasicMove{cf, ct}
28 {}
29 explicit bMove(bmove_t const bmt)
30 : bBasicMove{bmt}
31 {}
32 ~bMove() override
33 {}
34
37 m_score = m.m_score;
38 return *this;
39 }
41 { bBasicMove::operator=(std::move(m));
42 m_score = std::move(m.m_score);
43 return *this;
44 }
45
46 bool operator>(bMove const& r) const
47 { return realScore() > r.realScore(); }
48
49 bool isMateMove() const;
50
51 constexpr bScore getScore() const
52 { return m_score; }
53 inline bScore realScore() const
54 { return bSearchScore::realScore(m_score); }
55 inline void setScore(bScore const score)
56 { m_score = score; }
57 constexpr bScore getAbsScore() const
58 { return m_score < 0 ? -m_score : m_score; }
59 constexpr bool isDrawScore() const
60 { return (m_score == SCORE_THEORETIC_DRAW) || (m_score == SCORE_PRACTICAL_DRAW); }
61 constexpr bool isUndefinedScore() const
62 { return (m_score == SCORE_PUNDEFINED) || (m_score == SCORE_UNDEFINED); }
63 inline void clearScore()
64 { m_score = SCORE_UNDEFINED; }
65
66 std::string getMoveEvalStr() const;
67
68private:
69 bScore m_score = SCORE_UNDEFINED;
70};
71
72#endif // defined MOVE_H
73
74// eof
uint32_t bmove_t
Definition belofte.h:98
uint8_t case_t
Definition belofte.h:96
bBasicMove & operator=(bBasicMove const &bm)
Definition basicmove.h:33
bMove(bMove const &m)
Definition move.h:18
bScore realScore() const
Definition move.h:53
constexpr bool isUndefinedScore() const
Definition move.h:61
bMove()
Definition move.h:15
constexpr bool isDrawScore() const
Definition move.h:59
void clearScore()
Definition move.h:63
bMove & operator=(bMove const &m)
Definition move.h:35
bMove(bMove &&m)
Definition move.h:22
bMove(bmove_t const bmt)
Definition move.h:29
std::string getMoveEvalStr() const
Definition move.cpp:17
bool isMateMove() const
Check if end of game flag is set, and not forced draw.
Definition move.cpp:41
constexpr bScore getAbsScore() const
Definition move.h:57
bMove & operator=(bMove &&m)
Definition move.h:40
bool operator>(bMove const &r) const
Definition move.h:46
~bMove() override
Definition move.h:32
bMove(case_t cf, case_t ct)
Definition move.h:26
constexpr bScore getScore() const
Definition move.h:51
void setScore(bScore const score)
Definition move.h:55
constexpr bScore realScore() const
Definition searchscore.h:66
constexpr bScore SCORE_PUNDEFINED
Definition eval.h:20
int16_t bScore
Definition eval.h:11
constexpr bScore SCORE_PRACTICAL_DRAW
Definition eval.h:18
constexpr bScore SCORE_UNDEFINED
Definition eval.h:21
constexpr bScore SCORE_THEORETIC_DRAW
Definition eval.h:17