Commit 3c6591d4 authored by Jason Riggs's avatar Jason Riggs

change

parent ad421650
#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
#ifndef ERROR_H
#define ERROR_H
#include <cstring>
class Error {
public:
bool isValidAdjacent(int row, int col, char board[][8], char oppTurn);
bool isValidFlip(int row, int col, char board[][8], char playerTurn);
private:
};
#endif
\ No newline at end of file
#include "Pieces.h"
using namespace std;
\ No newline at end of file
#ifndef PIECES_H
#define PIECES_H
#include <vector>
#include <string>
using namespace std;
class Pieces {
public:
private:
};
#endif
\ No newline at end of file
https://www.dreamincode.net/forums/topic/72193-othello-game/
\ 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