Submission.
This commit is contained in:
parent
73e5f291c0
commit
24dcec83fe
3 changed files with 47 additions and 44 deletions
BIN
hw2/hw2.zip
Normal file
BIN
hw2/hw2.zip
Normal file
Binary file not shown.
|
@ -214,10 +214,11 @@ int main(int argc, char **argv)
|
|||
tree = makeTree(input.substr(1), root, 1);
|
||||
root = get<0>(tree);
|
||||
|
||||
printTree(root);
|
||||
//printTree(root);
|
||||
minmax(&root);
|
||||
|
||||
printTree(root);
|
||||
//printTree(root);
|
||||
cout << root.getValue() << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ void minmax(node *n)
|
|||
if(n->getLevel() % 2 == 0)
|
||||
{
|
||||
int max = n->getValue();
|
||||
|
||||
if(n->getChildren().size() > 0)
|
||||
{
|
||||
for(int c = 0; c < n->getChildren().size(); c++)
|
||||
|
@ -27,7 +28,7 @@ void minmax(node *n)
|
|||
n->getChildAt(c)->setBeta(n->getBeta());
|
||||
n->getChildAt(c)->setAlpha(n->getAlpha());
|
||||
|
||||
cout << "Alpha: " << n->getAlpha() << " Beta: " << n->getBeta() << endl;
|
||||
//cout << "Alpha: " << n->getAlpha() << " Beta: " << n->getBeta() << endl;
|
||||
|
||||
minmax(n->getChildAt(c));
|
||||
|
||||
|
@ -48,8 +49,8 @@ void minmax(node *n)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
n->setValue(max);
|
||||
//cout << n->getValue() << endl;
|
||||
}
|
||||
|
||||
else
|
||||
|
@ -62,7 +63,7 @@ void minmax(node *n)
|
|||
n->getChildAt(c)->setBeta(n->getBeta());
|
||||
n->getChildAt(c)->setAlpha(n->getAlpha());
|
||||
|
||||
cout << "Alpha: " << n->getAlpha() << " Beta: " << n->getBeta() << endl;
|
||||
//cout << "Alpha: " << n->getAlpha() << " Beta: " << n->getBeta() << endl;
|
||||
|
||||
minmax(n->getChildAt(c));
|
||||
|
||||
|
@ -83,8 +84,8 @@ void minmax(node *n)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
n->setValue(min);
|
||||
//cout << n->getValue() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -242,10 +243,11 @@ int main(int argc, char **argv)
|
|||
tree = makeTree(input.substr(1), root, 1);
|
||||
root = get<0>(tree);
|
||||
|
||||
printTree(root);
|
||||
//printTree(root);
|
||||
minmax(&root);
|
||||
|
||||
printTree(root);
|
||||
//printTree(root);
|
||||
cout << root.getValue() << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Reference in a new issue