Commit b58938ff authored by Jason Riggs's avatar Jason Riggs
Browse files

change

parent 85a9d8c8
#include <iostream>
#include <cstring>
using namespace std;
#include "Error.h"
bool Error::isValidAdjacent(int row, int col, char board[][8], char oppTurn) {
if (board[row + 1][col] == oppTurn) {
return true;
}
else if (board[row - 1][col] == oppTurn) {
return true;
}
else if (board[row][col + 1] == oppTurn) {
return true;
}
else if (board[row][col - 1] == oppTurn) {
return true;
}
else if (board[row - 1][col - 1] == oppTurn) {
return true;
}
else if (board[row - 1][col + 1] == oppTurn) {
return true;
}
else if (board[row + 1][col - 1] == oppTurn) {
return true;
}
else if (board[row + 1][col + 1] == oppTurn) {
return true;
}
return false;
}
bool isValidFlip(int row, int col, char board[][8], char playerTurn) {
for (int i = 2; i < 8; i++) {
if (board[row][col + i] == playerTurn) {
return true;
}
else if (board[row][col - i] == playerTurn) {
return true;
}
else if (board[row + i][col] == playerTurn) {
return true;
}
else if (board[row - i][col] == playerTurn) {
return true;
}
else if (board[row + i][col + i] == playerTurn) {
return true;
}
else if (board[row + i][col - i] == playerTurn) {
return true;
}
else if (board[row - i][col + i] == playerTurn) {
return true;
}
else if (board[row - i][col - i] == playerTurn) {
return true;
}
}
return false;
}
\ No newline at end of file
Supports Markdown
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