diff --git a/Engine.cpp b/Engine.cpp index cf7acf9..8b07782 100755 --- a/Engine.cpp +++ b/Engine.cpp @@ -6,7 +6,8 @@ Engine::Engine(){ - Board b = new Board(); + Board* brd = new Board(); + b = brd; } void Engine::startGame(){ @@ -25,45 +26,45 @@ void Engine::startGame(){ bool gameOver = false; vector record; - b.snapshot(record,b); + b->snapshot(record, *b); while (gameOver != true) { - gameOver = b.isGameOver(); + gameOver = b->isGameOver(); - while(b.getTurn() == 'O' ) + while(b->getTurn() == 'O' ) { - b.displayBoard(); + b->displayBoard(); cout<<"\nEnter command: "; cin>>move; - b.interpret(move,b); + b->interpret(move, *b); } - vector possibleMoves = b.viewPossibleMoves(); + vector possibleMoves = b->viewPossibleMoves(); if (choice == 1) { - cout << "a"; - b.easyAI(); + cout << "easyAI"; + easyAI(); } else { - while(b.getTurn() == 'X' ) + while(b->getTurn() == 'X' ) { - b.displayBoard(); + b->displayBoard(); cout<<"\nEnter command: "; cout<<"OK\n"; cin>>move; - b.interpret(move,b); + b->interpret(move, *b); } } - //b.snapshot(); - gameOver = b.isGameOver(); + //b->snapshot(); + gameOver = b->isGameOver(); - b.snapshot(record,b); + b->snapshot(record, *b); } //for debugging purposes @@ -77,11 +78,11 @@ void Engine::startGame(){ } } -void Board::easyAI() +void Engine::easyAI() { //1) see all possible movements - vector listOfMoves = viewPossibleMoves(); + vector listOfMoves = b->viewPossibleMoves(); //obvious moves if (false){ @@ -100,10 +101,10 @@ void Board::easyAI() } } -void Board::AI(){ +void Engine::AI(){ //do things here } -void Board::minMax(){ +void Engine::minMax(){ //do more things here } \ No newline at end of file diff --git a/Engine.h b/Engine.h index da6f589..8baa665 100755 --- a/Engine.h +++ b/Engine.h @@ -5,10 +5,12 @@ using namespace std; class Engine { - Board b; + Board* b; public: Engine(); void startGame(); void easyAI(); + void AI(); + void minMax(); }; \ No newline at end of file