-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tree.h
50 lines (37 loc) · 906 Bytes
/
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
#pragma once
#include "Move.h"
namespace chess {
struct Tree;
class Move;
class Square;
struct TreeNode {
Move* move;
TreeNode* left;
TreeNode* right;
Tree* thisTree;
Tree* children;
char cumulativeDamage;
char maxCumulativeDamage;
char minCumulativeDamage;
TreeNode();
TreeNode(Move* move);
void setChildren(Tree* _children);
~TreeNode();
};
struct Tree {
TreeNode* tree;
TreeNode* last;
TreeNode* parent;
TreeNode* rootParent;
unsigned length;
char maxScore;
TreeNode* current;
static const char LeastScore = -104;
Tree();
void add(Move* move);
TreeNode* remove(TreeNode* p);
TreeNode* getAt(int i);
void updateDamage(unsigned level);
~Tree();
};
}