-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboard.h
More file actions
65 lines (56 loc) · 1.49 KB
/
board.h
File metadata and controls
65 lines (56 loc) · 1.49 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef __BOARD_H__
#define __BOARD_H__
#include <vector>
#include <memory>
#include <string>
#include "view.h"
#include "ai.h"
struct Coor{
int x;
int y;
};
class ChessPiece;
class Board {
std::vector<std::vector<std::shared_ptr<ChessPiece>>> theChessBoard; // The actual Board.
double bScore;//up = 1
double wScore;//down = 0
std::vector<std::vector<std::vector<std::shared_ptr<ChessPiece>>>> history;
bool canMove();
public:
std::vector<std::shared_ptr<View>> VecView;
bool wturn;
std::shared_ptr<AI> aiW;
std::shared_ptr<AI> aiB;
Board();
~Board();
void scoreUpdate(int color, double score);
bool isEmpty(int x, int y);
bool isCheckmate();
bool isCheck();
void clearBoard();
void initBoard();
void notifyView(char piece, Coor c);
void print();
bool castling(Coor start, Coor dest);
int resign(); // we need it here
void placePiece(char piece, Coor pos);
void removePiece(Coor pos);
void undo(bool inter);
bool isMove(Coor c);
// makemove(start, dest) return "empty" if no piece at start, return invalid if
// the move is invlid
std::string makeMove(Coor start, Coor dest);
std::shared_ptr<ChessPiece> getPos(Coor c);
int getBscore();
int getWscore();
void saveHistory();
//std::vector<std::string> *getHistory();
bool validBoard();
bool needPromotion();
Coor AIneedPromotion(int color);
void promote(char type);
bool isStalemate();
void setPlayer(const std::string &p1, const std::string &p2);
friend class AI;
};
#endif