Commit d84c1326 authored by Jason Riggs's avatar Jason Riggs

change

parent ebab5d6e
#include <iostream>
#include <vector>
#include "Board.h"
using namespace std;
\ No newline at end of file
using namespace std;
void displayBoard::start() {
board[4-1][4-1] = {'X'};
board[5-1][4-1] = {'O'};
board[5-1][5-1] = {'X'};
board[4-1][5-1] = {'O'};
}
void displayBoard::playerMove1(int x, int y) {
if (x > 8 || x < 0 || y > 8 || y < 0) {
cout << endl << "Invalid (X,Y) coordinates." << endl << endl;
} else {
board[x-1][y-1] = {'X'};
}
}
void displayBoard::playerMove2(int x, int y) {
if (x > 8 || x < 0 || y > 8 || y < 0) {
cout << endl << "Invalid (X,Y) coordinates." << endl << endl;
} else {
board[x-1][y-1] = {'O'};
}
}
void displayBoard::printBoard() {
cout << " 1 2 3 4 5 6 7 8 " << endl;
cout << " +---+---+---+---+---+---+---+---+ "<< endl;
for (int j=0; j<8; j++) {
cout << j+1 << " |";
for (int i=0; i<8; i++) {
if (isalpha(board[i][j])) {
cout << " " << board[i][j] << " |";
} else {
cout << " " << board[i][j] << " |";
}
}
cout << endl << " +---+---+---+---+---+---+---+---+ "<< endl;
}
}
char displayBoard::chipCheck(int x, int y) {
return board[x][y];
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment