#include #include #include #include #include "Engine.h" Engine::Engine(){ Board* brd = new Board(); b = brd; } void Engine::startGame(){ cout<<"WELCOME\n"; cout<<"1. Play against AI?\n"; cout<<"2. Play against a human?\n"; //cout<<"CHANGE THIS TO PARSE THINGS\n"; cout<<"Enter choice: \n"; int choice; cin >> choice; cout << "OK" << endl; string move; bool gameOver = false; vector record; b->snapshot(record, *b); while (gameOver != true) { gameOver = b->isGameOver(); while(b->getTurn() == 'O' ) { b->displayBoard(); cout<<"\nEnter command: "; cin>>move; b->interpret(move, *b); } vector possibleMoves = b->viewPossibleMoves(); if (choice == 1) { cout << "easyAI"; easyAI(); } else { while(b->getTurn() == 'X' ) { b->displayBoard(); cout<<"\nEnter command: "; cout<<"OK\n"; cin>>move; b->interpret(move, *b); } } //b->snapshot(); gameOver = b->isGameOver(); b->snapshot(record, *b); } //for debugging purposes cout<<"Record:"< listOfMoves = b->viewPossibleMoves(); //obvious moves if (false){ return; } //random else { srand(time(NULL)); int randomChoice = rand() % (listOfMoves.size()-1) - 0; // choose a move betwen listOfMoves[0] to last element //3) execute movement int temp = randomChoice; move(listOfMoves[randomChoice]); } } void Engine::AI(){ //do things here } void Engine::minMax(){ //do more things here }