-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tree.h
64 lines (53 loc) · 1.58 KB
/
Tree.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
/*
* S3:
* Created the Tree Class
* Added: generateChildren(), Suggest/Accept Move From Player();
* S4:
* Added: destructor();
* Implemented: ~Tree(), destructor();
* Implemented: generateChildren(), nextPlayer();
* Implemented: suggestMovesToPlayer(),acceptNextMove();
* Added: makeMoveAsComputer();
* S5:
* Tested: generateChildren(), nextPlayer();
* Tested: suggestMovesToPlayer(),acceptNextMove();
* Implemented: printLastBoardPosition();
* S6:
* Implemented: makeMoveAsComputer(), heuRec();
* Tested: makeMoveAsComputer(), heuRec();
* S7:
* Edited makeMoveAsComputer() and heuRec() -
* They have A-B-Pruning now *MAJOR*CHANGE*
*/
/** TO DO**/
/** (1) Implement makeMoveAsComputer() - MINIMAX!
**/
#include "Board.h"
#ifndef TREE_H
#define TREE_H
class Tree{
private:
struct item{
string name;
Board* board;
vector<item*> children;
int player;
};
int AIPlayer;
item* root;
item* lastMove;
void generateChildren(item* parent); // Working
void destructor(item* board); // Working?
int nextPlayer(item* board); // Working
int heuRec(item* now, int depth,string Type, int alpha, int beta);
public:
Tree(Board* root, int AIPlayerNumber);
~Tree();
string makeMoveAsComputer(int depth); // (!)INVOLVES MINIMAX(!)
string suggestMovesToPlayer(); // Working
bool acceptNextMove(string nextMove); // Working
Board* getCurrentBoard(); // Working
int getCurrentPlayer();
void printLastBoardPosition();
};
#endif // TREE_H