working on AI junk

This commit is contained in:
Rebecca Schofield 2015-10-26 15:22:59 -05:00
parent dc544a609b
commit 6fe1b333fd
2 changed files with 18 additions and 26 deletions

View file

@ -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;
@ -40,28 +40,11 @@ void Engine::startGame(){
b->interpret(move, *b);
}
vector<moves> 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);
}
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<moves> 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<moves> 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(){

View file

@ -4,5 +4,6 @@ using namespace std;
int main()
{
//
Engine e;
e.startGame();
}