merge and restructure
This commit is contained in:
parent
16d014edc0
commit
e06c7683fe
1 changed files with 0 additions and 82 deletions
82
main.cpp
82
main.cpp
|
@ -1,82 +0,0 @@
|
|||
#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();
|
||||
}
|
||||
}
|
Reference in a new issue