This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
breakthroughpine64backup/test.cpp
Rebecca Schofield c9ab7c2622 working on AI
2015-10-20 19:01:30 -05:00

76 lines
1.1 KiB
C++
Executable file

#include <iostream>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include "Board.h"
using namespace std;
int main()
{
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;
Board b;
string move;
bool gameOver = false;
vector<Board> 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<moves> possibleMoves = b.viewPossibleMoves();
if (choice == 1)
{
b.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:"<<endl;
cout<<record.size();
for (int i = 0; i < record.size(); ++i)
{
record[i].displayBoard();
}
}