tree DONE, no ab pruning

This commit is contained in:
Rebecca Schofield 2015-10-30 11:56:44 -05:00
parent 5f4c6c2539
commit 01b8e2c06b
3 changed files with 4 additions and 11 deletions

View file

@ -541,9 +541,6 @@ void Board::snapshot(vector<Board>& inputVec, Board inputBoard){
int Board::evaluate(char max){
int val = 0;
srand(time(NULL));
val = rand() % 100 + 1;
/*
if (max == 'X'){
val += (xpieces.size() - opieces.size());
}
@ -555,7 +552,7 @@ int Board::evaluate(char max){
else {
cout << "Error in evaluate: unidentified max, must be either 'X' or 'O'.\n";
}
*/
return val;
}

View file

@ -71,15 +71,14 @@ void Engine::AI(int depth){
MNode* root = new MNode(*state, m, 0);
createMMTree(root, depth);
m = evaluateMMTree(root);
cout << "\n";
/*
printTree(0, root);
cout << "\n";
cout << "AI move: (" << m.row << ", " << m.column << "): " << m.moveType << "\n";
*/
vector<moves> listOfMoves = b->viewPossibleMoves();
b->move(listOfMoves[0]);
b->move(m);
b->changeTurns();
b->displayBoard();
}
@ -118,7 +117,6 @@ moves Engine::evaluateMMTree(MNode* node){
for (auto &c : children){
val = evaluateMMBranch(c, 0);
if(val > max){
temp = c;
max = val;

View file

@ -6,6 +6,4 @@ int main()
{
Engine e;
e.startGame();
//COMPILES BUT EVERYTHING IS PRINTING FIRST MOVE
}