completely finished board restructure
This commit is contained in:
parent
7859237ced
commit
f326187388
4 changed files with 50 additions and 1 deletions
|
@ -1,5 +1,9 @@
|
|||
#include <iostream>
|
||||
#include <vector>
|
||||
#include "Board.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
Board::Board() {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
for (int j = 0; j < 8; ++j) {
|
||||
|
@ -82,7 +86,7 @@ void Board::changeTurns()
|
|||
else turn = 'O';
|
||||
}
|
||||
|
||||
void BoarddisplayBoard()
|
||||
void Board::displayBoard()
|
||||
{
|
||||
cout<<"\n\n";
|
||||
cout<<" A B C D E F G H"<<endl;
|
||||
|
|
3
Board.h
3
Board.h
|
@ -1,5 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
struct moves {
|
||||
|
|
BIN
a.out
BIN
a.out
Binary file not shown.
42
test.cpp
Executable file
42
test.cpp
Executable file
|
@ -0,0 +1,42 @@
|
|||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "Board.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
cout<<"Welcome to Breakthrough\n"<<endl;
|
||||
cout<<"playing with AI..."<<endl;
|
||||
|
||||
Board b;
|
||||
|
||||
string move;
|
||||
|
||||
bool gameOver = false;
|
||||
|
||||
while (gameOver != true)
|
||||
{
|
||||
gameOver = b.isGameOver();
|
||||
|
||||
while(b.getTurn() == 'O')
|
||||
{
|
||||
b.displayBoard();
|
||||
cout<<"\nEnter move: ";
|
||||
cin>>move;
|
||||
b.move(move);
|
||||
}
|
||||
|
||||
|
||||
vector<moves> possibleMoves = b.viewPossibleMoves();
|
||||
//displayPossibleMoves(possibleMoves); for debugging purposes - AI
|
||||
|
||||
|
||||
b.easyAI();
|
||||
|
||||
gameOver = b.isGameOver();
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue