diff --git a/Board.cpp b/Board.cpp index 072fc95..92f0e08 100644 --- a/Board.cpp +++ b/Board.cpp @@ -541,9 +541,6 @@ void Board::snapshot(vector& 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; } diff --git a/Engine.cpp b/Engine.cpp index 5430dbb..83bf785 100644 --- a/Engine.cpp +++ b/Engine.cpp @@ -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 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; diff --git a/test.cpp b/test.cpp index 302979c..8b1eb77 100644 --- a/test.cpp +++ b/test.cpp @@ -6,6 +6,4 @@ int main() { Engine e; e.startGame(); - - //COMPILES BUT EVERYTHING IS PRINTING FIRST MOVE }