-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrincipalVariation.cpp
51 lines (40 loc) · 995 Bytes
/
PrincipalVariation.cpp
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
40
41
42
43
44
45
46
47
48
49
50
51
#include "PrincipalVariation.hpp"
#include <ostream>
bool PrincipalVariation::isMate() const {
return m;
}
int PrincipalVariation::score() const {
return s;
}
std::size_t PrincipalVariation::length() const {
return pv.size();
}
PrincipalVariation::MoveIter PrincipalVariation::begin() const {
return pv.begin();
}
PrincipalVariation::MoveIter PrincipalVariation::end() const {
return pv.end();
}
void PrincipalVariation::makeMoveVc(std::vector<Move> p){
pv=p;
}
void PrincipalVariation::setScore(int score){
s=score;
}
void PrincipalVariation::setMate(bool mt){
m=mt;
}
Move::Optional PrincipalVariation::getMove(int i) const {
if(i>=0 && i<(int)this->length()){
return pv[i];
}
return std::nullopt;
}
std::ostream& operator<<(std::ostream& os, const PrincipalVariation& pv) {
std::string s = "";
int l = pv.length();
for(int it = 0; it < l;++it){
s+= pv.getMove(it).value().toUci();
}
return os<<s;
}