tree DONE, no ab pruning
This commit is contained in:
parent
5f4c6c2539
commit
01b8e2c06b
3 changed files with 4 additions and 11 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
2
test.cpp
2
test.cpp
|
@ -6,6 +6,4 @@ int main()
|
|||
{
|
||||
Engine e;
|
||||
e.startGame();
|
||||
|
||||
//COMPILES BUT EVERYTHING IS PRINTING FIRST MOVE
|
||||
}
|
||||
|
|
Reference in a new issue