-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathminimax_test.cpp
More file actions
60 lines (43 loc) · 1.21 KB
/
Copy pathminimax_test.cpp
File metadata and controls
60 lines (43 loc) · 1.21 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
//============================================================================
// Name : cs4511.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
#include <cstdlib>
#include "Tree.h"
#include "Node.h"
#include "minimax.h"
using namespace std;
int main(int args, char** argv) {
cout << "start Tree Test" << endl;
int i = 5;
int* x = new int(10);
Tree<Node<int>,int> *tree = new Tree<Node<int>,int>(x);
srand ( time(NULL) );
while (i > 0) {
//cout << "step " << i << endl;
int* in = new int(rand()%100);
Node<int>* n = new Node<int>(in);
tree->addChild(n);
for (int j = 0; j < 2; j++) {
int* inn = new int(rand()%100);
Node<int>* m = new Node<int>(inn);
n->addChild(m);
for (int x = 0; x < 2; x++) {
int* inn = new int(rand()%100);
Node<int>* mm = new Node<int>(inn);
m->addChild(mm);
}
}
i--;
}
Node<int>* root = tree;
Node<int>* value = minimax<Node<int>, int > (root);
tree.print();
cout << "minimax returned: " << *value->getValue() << endl;
cout << "done" << endl;
return 0;
}