This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
breakthroughpine64backup/MNode.cpp
2015-11-02 16:19:42 -06:00

43 lines
No EOL
771 B
C++
Executable file

#include <iostream>
#include <vector>
#include "MNode.h"
using namespace std;
MNode::MNode(){
children.clear();
minimax_val = -1;
}
MNode::MNode(Board s, moves m, int mmval){
state = s;
mvs = m;
minimax_val = mmval;
}
MNode::MNode(const MNode& n){
children = n.getChildren();
minimax_val = n.getMMVal();
}
void MNode::setMMVal(int mmval) {
minimax_val = mmval;
}
bool MNode::hasChildren(){
if (children.size() != 0)
return true;
else
return false;
}
void printTree(int depth, MNode* n){
vector<MNode*> children;
cout << "depth " << depth << " : " << n->getMMVal() << "\n";
children = n->getChildren();
//print out root
for (int i = 0; i < children.size(); ++i){
printTree(++depth, children[i]);
}
}