diff --git a/Engine.cpp b/Engine.cpp index 8b07782..e69caf0 100755 --- a/Engine.cpp +++ b/Engine.cpp @@ -18,7 +18,7 @@ void Engine::startGame(){ //cout<<"CHANGE THIS TO PARSE THINGS\n"; cout<<"Enter choice: \n"; - int choice; + int choice = -1; cin >> choice; cout << "OK" << endl; @@ -38,30 +38,13 @@ void Engine::startGame(){ cout<<"\nEnter command: "; cin>>move; b->interpret(move, *b); - } - - - vector possibleMoves = b->viewPossibleMoves(); - - if (choice == 1) - { - cout << "easyAI"; - easyAI(); } - else + while(b->getTurn() == 'X' ) { - while(b->getTurn() == 'X' ) - { - b->displayBoard(); - cout<<"\nEnter command: "; - cout<<"OK\n"; - cin>>move; - b->interpret(move, *b); - } + AI(); } - //b->snapshot(); gameOver = b->isGameOver(); b->snapshot(record, *b); @@ -81,12 +64,11 @@ void Engine::startGame(){ void Engine::easyAI() { //1) see all possible movements - vector listOfMoves = b->viewPossibleMoves(); //obvious moves if (false){ - return; + b->changeTurns(); } //random @@ -96,13 +78,22 @@ void Engine::easyAI() //3) execute movement int temp = randomChoice; - - move(listOfMoves[randomChoice]); + b->move(listOfMoves[randomChoice]); } } void Engine::AI(){ - //do things here + vector listOfMoves = b->viewPossibleMoves(); + + cout << "rows: \n\n"; + for (int i = 0; i < listOfMoves.size(); ++i){ + cout << "i: " << listOfMoves[i].row << "\n"; + } + + cout << "columns: \n\n"; + for (int i = 0; i < listOfMoves.size(); ++i){ + cout << "i: " << listOfMoves[i].column << "\n"; + } } void Engine::minMax(){ diff --git a/test.cpp b/test.cpp index a0f9d72..8b1eb77 100755 --- a/test.cpp +++ b/test.cpp @@ -4,5 +4,6 @@ using namespace std; int main() { - // + Engine e; + e.startGame(); }