2015-10-19 15:36:20 -05:00
|
|
|
#pragma once
|
|
|
|
|
2015-10-19 15:56:21 -05:00
|
|
|
#include <iostream>
|
|
|
|
#include <vector>
|
2015-10-27 10:40:55 -05:00
|
|
|
#include "Piece.h"
|
2015-10-19 15:56:21 -05:00
|
|
|
|
2015-10-19 15:36:20 -05:00
|
|
|
using namespace std;
|
|
|
|
|
2015-10-19 15:45:41 -05:00
|
|
|
struct moves {
|
|
|
|
int row;
|
2015-10-27 17:30:33 -05:00
|
|
|
int column;
|
2015-10-19 15:45:41 -05:00
|
|
|
string moveType;
|
2015-10-29 08:58:32 -05:00
|
|
|
|
|
|
|
moves() {
|
|
|
|
row = -1;
|
|
|
|
column = -1;
|
|
|
|
moveType = "";
|
|
|
|
}
|
2015-10-19 15:45:41 -05:00
|
|
|
|
|
|
|
moves(int linea, int columna, string m) {
|
|
|
|
row = linea;
|
|
|
|
column = columna;
|
|
|
|
moveType = m;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-10-19 15:36:20 -05:00
|
|
|
class Board {
|
2015-10-27 10:40:55 -05:00
|
|
|
vector<Piece*> xpieces;
|
|
|
|
vector<Piece*> opieces;
|
2015-10-27 11:31:44 -05:00
|
|
|
vector<Piece*> pieces;
|
2015-10-19 15:36:20 -05:00
|
|
|
char turn = 'O';
|
2015-10-27 17:30:33 -05:00
|
|
|
bool valid = false;
|
2015-10-19 15:36:20 -05:00
|
|
|
|
|
|
|
public:
|
|
|
|
Board();
|
2015-10-27 12:55:23 -05:00
|
|
|
Board(const Board& b);
|
2015-10-28 17:12:44 -05:00
|
|
|
void setValidFalse(){ valid = false; }
|
|
|
|
void setValidTrue(){ valid = true; }
|
|
|
|
bool isValid(){ return valid; }
|
2015-10-27 11:31:44 -05:00
|
|
|
bool isPiece(int r, int c);
|
|
|
|
Piece* getPiece(int r, int c);
|
2015-10-28 17:12:44 -05:00
|
|
|
void isTaken(int r, int c);
|
2015-10-27 12:55:23 -05:00
|
|
|
vector<Piece*> getXPieces() const { return xpieces; }
|
|
|
|
vector<Piece*> getOPieces() const { return opieces; }
|
2015-10-27 21:48:04 -05:00
|
|
|
char getTurnPls() const { return turn; }
|
2015-10-19 15:36:20 -05:00
|
|
|
moves parse(string input);
|
|
|
|
char getTurn() { return turn; }
|
|
|
|
bool isGameOver();
|
2015-10-28 17:12:44 -05:00
|
|
|
string whoWon();
|
2015-10-19 15:36:20 -05:00
|
|
|
void changeTurns();
|
|
|
|
void displayBoard();
|
2015-10-27 11:51:37 -05:00
|
|
|
string boardToString();
|
2015-10-19 15:45:41 -05:00
|
|
|
int charToIntColumn(char input);
|
|
|
|
char intToCharColumn(int input);
|
2015-10-27 11:31:44 -05:00
|
|
|
void move(string inputMove);
|
2015-10-29 08:58:32 -05:00
|
|
|
Board move(moves m);
|
2015-10-27 11:31:44 -05:00
|
|
|
bool isThisMovePossible(int r, int c, string moveType);
|
|
|
|
vector<moves> viewPossibleMoves();
|
2015-10-19 15:45:41 -05:00
|
|
|
string myToUpper(string input);
|
2015-10-19 16:37:20 -05:00
|
|
|
void undo(Board& tablero);
|
|
|
|
void interpret(string input, Board& tablero);
|
|
|
|
void snapshot(vector<Board>& inputVec, Board inputBoard);
|
2015-10-29 13:54:16 -05:00
|
|
|
int evaluate(char max);
|
2015-10-29 08:58:32 -05:00
|
|
|
};
|