diff --git a/Board.cpp b/Board.cpp index d428ac5..a7c7f8e 100755 --- a/Board.cpp +++ b/Board.cpp @@ -261,7 +261,7 @@ void Board::move(moves m){ int row = 8 - (m.row); int column = m.column; - cout << "INSIDE MOVE: " << row << " " << column << "\n\n"; + cout << "INSIDE MOVE: " << row << " " << column << " " << m.moveType << "\n\n"; if (row > 8 || row < 0 || column > 8 || column < 0) { cout<<"ERROR: index out of bound."<getX() << " " << piece->getY() << "\n\n"; + //cout << piece->getX() << " " << piece->getY() << "\n\n"; piece->moveRight(); - cout << piece->getX() << " " << piece->getY() << "\n\n"; + //cout << piece->getX() << " " << piece->getY() << "\n\n"; } } setValidTrue(); @@ -379,7 +379,7 @@ bool Board::isThisMovePossible(int r, int c, string moveType){ else if(temp->getType() != piece->getType()) { char a = temp->getType(); char b = piece->getType(); - cout << a << " " << b << "\n\n"; + //cout << a << " " << b << "\n\n"; return true; } else { @@ -401,7 +401,7 @@ bool Board::isThisMovePossible(int r, int c, string moveType){ else if(temp->getType() != piece->getType()) { char a = temp->getType(); char b = piece->getType(); - cout << a << " " << b << "\n\n"; + //cout << a << " " << b << "\n\n"; return true; } else { @@ -445,7 +445,8 @@ vector Board::viewPossibleMoves(){ } } - else if (turn == '0') { + else if (turn == 'O') { + //cout << "\nTESTING\n\n"; for (int i = 0; i < opieces.size(); ++i){ r = opieces[i]->getX(); c = opieces[i]->getY(); diff --git a/Engine.cpp b/Engine.cpp index 391f0ab..18efac8 100755 --- a/Engine.cpp +++ b/Engine.cpp @@ -43,11 +43,11 @@ void Engine::startGame(){ } } - if(b->isValid()) cout << b->getTurn(); + //if(b->isValid()) cout << b->getTurn(); while(b->getTurn() == 'X' ) { - easyAI(); + AI(); } gameOver = b->isGameOver(); @@ -107,14 +107,15 @@ void Engine::AI(){ moves Engine::minMax(Board* temp, moves m, int c, int r){ //testing purposes only, c = finite depth - cout << "c: " << c << "\n\n"; - cout << "current turn: " << temp->getTurn() << "\n"; + //cout << "c: " << c << "\n\n"; + //cout << "current turn: " << temp->getTurn() << "\n"; vector listOfMoves = temp->viewPossibleMoves(); - cout << "listOfMoves size: " << listOfMoves.size() << "\n\n"; + //cout << "listOfMoves size: " << listOfMoves.size() << "\n\n"; + /* if (c > 5){ return m; } - + */ if (temp->isGameOver() == true){ cout << "END OF PATH REACHED\n"; return m; @@ -122,19 +123,20 @@ moves Engine::minMax(Board* temp, moves m, int c, int r){ else { if(temp->getPiece(8 - m.row, m.column)->getType() == temp->getTurn() && temp->isThisMovePossible(8 - m.row, m.column, m.moveType)){ - cout << "piece has been moved in minMax\n"; + //cout << "piece has been moved in minMax\n"; temp->move(m); temp->changeTurns(); - //temp->displayBoard(); + temp->displayBoard(); } else { - cout << m.row << " " << m.column << "\n\n"; + //cout << m.row << " " << m.column << "\n\n"; m = minMax(temp, listOfMoves[++r], c, r); } - temp->displayBoard(); + //temp->displayBoard(); vector listOfMoves = temp->viewPossibleMoves(); - minMax(temp, listOfMoves[c], ++c, 0); + //cout << "listOfMoves size: " << listOfMoves.size() << "\n\n"; + minMax(temp, listOfMoves[0], 0, 0); //testing return m;