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
Alexander Huddleston fb602ef2c2 Updating branch.
2015-10-29 22:52:18 -05:00

43 lines
No EOL
774 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, const MNode& n){
vector<MNode*> children;
cout << "depth " << depth << " :" << n.getMMVal() << " ";
children = n.getChildren();
//print out root
for (int i = 0; i < children.size(); ++i){
printTree(++depth, *children[i]);
}
}