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/main.cpp
2015-10-19 16:45:38 -05:00

82 lines
1.3 KiB
C++

#include <iostream>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include "Board.h"
using namespace std;
int main()
{
cout<<"\n----------------------------"<<endl;
cout<<"Welcome to Breakthrough\n"<<endl;
cout<<"-----------------------------\n\n"<<endl;
cout<<"1. Play agains AI?"<<endl;
cout<<"2. Play against a human?"<<endl;
cout<<"Enter choice: "<<endl;
int choice;
cin >> choice;
if (choice == 1) cout<<"playing with AI..."<<endl;
else cout<<"playing with human..."<<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();
//displayPossibleMoves(possibleMoves); for debugging purposes - AI
if (choice == 1)
{
b.easyAI();
}
else
{
while(b.getTurn() == 'X' )
{
b.displayBoard();
cout<<"\nEnter command: ";
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();
}
}