-
Notifications
You must be signed in to change notification settings - Fork 0
/
Board.h
77 lines (64 loc) · 1.36 KB
/
Board.h
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
66
67
68
69
70
71
72
73
74
75
76
77
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <ctype.h>
#include <climits>
#include <algorithm>
class Board{
public:
int dimension;
std::vector<std::string> **board;
class Player{
public:
int flatStones;
int capStones;
Player(int flats,int caps)
{
this->flatStones = flats;
this->capStones = caps;
}
};
std::vector<Player> listOfPlayers;
Board(){
}
Board(int n){
this->dimension = n;
//Default as 5*5
listOfPlayers.push_back(Player(21,1));
listOfPlayers.push_back(Player(21,1));
board = new std::vector<std::string>*[dimension];
for(int i=0;i<dimension;i++)
board[i] = new std::vector<std::string>[dimension];
}
// Board(Board &b){
// this->dimension = b.dimension;
// this->listOfPlayers = NULL;
// this->board = NULL;
// }
void makeMove(int playerNo, std::string move);
int squareToNum(std::string sqStr);
std::vector<std::string> getValidMoves(int currentPiece);
int evaluate();
void setDimension(int n);
};
struct Node
{
Node** children;
int no_of_children;
int value;
void deleteNode();
};
class Tree{
public:
Node* tree;
int bestMove;
Tree(Board board, int playerNo)
{
tree = makeTree(board,0,playerNo);
bestMove = -1;
}
Node* makeTree(Board board, int depth, int playerNo);
void deleteTree();
int minimax(Node* root, int depth, bool maxNode, int alpha, int beta);
};