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

43 lines
771 B
C++
Raw Permalink Normal View History

2015-10-29 08:58:32 -05:00
#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;
}
2015-10-29 13:06:15 -05:00
void printTree(int depth, MNode* n){
2015-10-29 08:58:32 -05:00
vector<MNode*> children;
cout << "depth " << depth << " : " << n->getMMVal() << "\n";
2015-10-29 13:06:15 -05:00
children = n->getChildren();
2015-10-29 08:58:32 -05:00
//print out root
for (int i = 0; i < children.size(); ++i){
2015-10-29 13:06:15 -05:00
printTree(++depth, children[i]);
2015-10-29 08:58:32 -05:00
}
}