64 lines
1.5 KiB
C++
64 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <iostream>
|
|
#include <vector>
|
|
#include "Piece.h"
|
|
|
|
using namespace std;
|
|
|
|
struct moves {
|
|
int row;
|
|
int column;
|
|
string moveType;
|
|
|
|
moves() {
|
|
row = -1;
|
|
column = -1;
|
|
moveType = "";
|
|
}
|
|
|
|
moves(int linea, int columna, string m) {
|
|
row = linea;
|
|
column = columna;
|
|
moveType = m;
|
|
}
|
|
};
|
|
|
|
class Board {
|
|
vector<Piece*> xpieces;
|
|
vector<Piece*> opieces;
|
|
vector<Piece*> pieces;
|
|
char turn = 'O';
|
|
bool valid = false;
|
|
|
|
public:
|
|
Board();
|
|
Board(const Board& b);
|
|
void setValidFalse(){ valid = false; }
|
|
void setValidTrue(){ valid = true; }
|
|
bool isValid(){ return valid; }
|
|
bool isPiece(int r, int c);
|
|
Piece* getPiece(int r, int c);
|
|
void isTaken(int r, int c);
|
|
vector<Piece*> getXPieces() const { return xpieces; }
|
|
vector<Piece*> getOPieces() const { return opieces; }
|
|
char getTurnPls() const { return turn; }
|
|
moves parse(string input);
|
|
char getTurn() { return turn; }
|
|
bool isGameOver();
|
|
string whoWon();
|
|
void changeTurns();
|
|
void displayBoard();
|
|
string boardToString();
|
|
int charToIntColumn(char input);
|
|
char intToCharColumn(int input);
|
|
void move(string inputMove);
|
|
Board move(moves m);
|
|
bool isThisMovePossible(int r, int c, string moveType);
|
|
vector<moves> viewPossibleMoves();
|
|
string myToUpper(string input);
|
|
void undo(Board& tablero);
|
|
void interpret(string input, Board& tablero);
|
|
void snapshot(vector<Board>& inputVec, Board inputBoard);
|
|
int evaluate(char max, char min);
|
|
};
|