76 lines
1.1 KiB
C++
Executable file
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();
|
|
}
|
|
}
|