diff --git a/Board.cpp b/Board.cpp index 0571348..479dfd1 100755 --- a/Board.cpp +++ b/Board.cpp @@ -89,16 +89,16 @@ void Board::changeTurns() void Board::displayBoard() { cout<<"\n\n"; - cout<<" A B C D E F G H"< Board::viewPossibleMoves() { vector output; @@ -479,7 +474,70 @@ void Board::displayPossibleMoves(vector input) cout<<"possible move: "< record; + if (record.size() < 2) + { + cout<<"nothing to undo"< record; + input = myToUpper(input); + + if (input == "UNDO") + { + undo(tablero); + } + + else if (input == "DISPLAYRECORD") //for debugging purposes + { + cout<<"record: "<& inputVec, Board inputBoard) +{ + if (inputVec.size() == 10) + { + inputVec.erase(inputVec.begin()); + } + + else if (inputVec.size() > 10) + { + cout<<"QUEUE OVERFLOW!"< viewPossibleMoves(); string myToUpper(string input); void displayPossibleMoves(vector input); + void undo(Board& tablero); + void interpret(string input, Board& tablero); + void snapshot(vector& inputVec, Board inputBoard); void easyAI(); }; \ No newline at end of file diff --git a/a.out b/a.out index 02b0976..20d22fc 100755 Binary files a/a.out and b/a.out differ diff --git a/main.cpp b/main.cpp deleted file mode 100644 index 6e8a8e0..0000000 --- a/main.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include -#include -#include -#include "GameEngine.h" - -using namespace std; - -int main() -{ - - cout<<"Welcome to Breakthrough\n"<>move; - b.move(move); - } - - - vector possibleMoves = b.viewPossibleMoves(); - //displayPossibleMoves(possibleMoves); for debugging purposes - AI - - - b.easyAI(); - - gameOver = b.isGameOver(); - } - -} diff --git a/test.cpp b/test.cpp index 4d6518a..368e689 100755 --- a/test.cpp +++ b/test.cpp @@ -8,35 +8,69 @@ using namespace std; int main() { - cout<<"Welcome to Breakthrough\n"<> choice; + cout << "OK" << endl; Board b; - string move; bool gameOver = false; + vector record; + b.snapshot(record,b); while (gameOver != true) { gameOver = b.isGameOver(); - while(b.getTurn() == 'O') + while(b.getTurn() == 'O' ) { b.displayBoard(); - cout<<"\nEnter move: "; + cout<<"\nEnter command: "; cin>>move; - b.move(move); + b.interpret(move,b); } vector possibleMoves = b.viewPossibleMoves(); //displayPossibleMoves(possibleMoves); for debugging purposes - AI + if (choice == 1) + { + b.easyAI(); + } + + else + { + while(b.getTurn() == 'X' ) + { + b.displayBoard(); + cout<<"\nEnter command: "; + cin>>move; + b.interpret(move,b); + } + } - b.easyAI(); - + //b.snapshot(); gameOver = b.isGameOver(); + + b.snapshot(record,b); } + //for debugging purposes + cout<<"Record:"<