-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmove.cpp
More file actions
39 lines (31 loc) · 900 Bytes
/
move.cpp
File metadata and controls
39 lines (31 loc) · 900 Bytes
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
#include<iostream>
#include<cassert>
#include<string>
#include "board.h"
#include "move.h"
#include "utils.h"
using namespace std;
Move::Move(int from, int to, bool is_capture, int promoted) {
this->from = (square_type) from;
this->to = (square_type) to;
this->is_capture = is_capture;
this->promoted = (piece_type) promoted;
}
string Move::getStr() {
assert(0 <= from && from < 64);
assert(0 <= to && to < 64);
string from = sqtostr(this->from);
string to = sqtostr(this->to);
string ret = "";
ret += from;
ret += to;
//cout<<"Is captured: "<<is_capture<<endl;
//cout<<"Promoted: "<<promoted<<endl;
if (promoted != NO_PIECE) {
if (promoted == WQ || promoted == BQ) ret += "q";
if (promoted == WR || promoted == BR) ret += "r";
if (promoted == WB || promoted == BB) ret += "b";
if (promoted == WN || promoted == BN) ret += "n";
}
return ret;
}