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<<"CHANGE THIS TO PARSE THINGS\n";
cout<<"Enter choice: \n"; cout<<"Enter choice: \n";
int choice; int choice = -1;
cin >> choice; cin >> choice;
cout << "OK" << endl; cout << "OK" << endl;
@ -38,30 +38,13 @@ void Engine::startGame(){
cout<<"\nEnter command: "; cout<<"\nEnter command: ";
cin>>move; cin>>move;
b->interpret(move, *b); b->interpret(move, *b);
}
vector<moves> possibleMoves = b->viewPossibleMoves();
if (choice == 1)
{
cout << "easyAI";
easyAI();
} }
else while(b->getTurn() == 'X' )
{ {
while(b->getTurn() == 'X' ) AI();
{
b->displayBoard();
cout<<"\nEnter command: ";
cout<<"OK\n";
cin>>move;
b->interpret(move, *b);
}
} }
//b->snapshot();
gameOver = b->isGameOver(); gameOver = b->isGameOver();
b->snapshot(record, *b); b->snapshot(record, *b);
@ -81,12 +64,11 @@ void Engine::startGame(){
void Engine::easyAI() void Engine::easyAI()
{ {
//1) see all possible movements //1) see all possible movements
vector<moves> listOfMoves = b->viewPossibleMoves(); vector<moves> listOfMoves = b->viewPossibleMoves();
//obvious moves //obvious moves
if (false){ if (false){
return; b->changeTurns();
} }
//random //random
@ -96,13 +78,22 @@ void Engine::easyAI()
//3) execute movement //3) execute movement
int temp = randomChoice; int temp = randomChoice;
b->move(listOfMoves[randomChoice]);
move(listOfMoves[randomChoice]);
} }
} }
void Engine::AI(){ 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(){ void Engine::minMax(){

View file

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