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-11-03 23:00:12 -06:00
|
|
|
vector<Board> record;
|
2015-11-02 16:19:42 -06:00
|
|
|
bool valid, xtaken, otaken;
|
2015-11-03 23:00:12 -06:00
|
|
|
char turn = 'O';
|
2015-10-19 15:36:20 -05:00
|
|
|
|
|
|
|
public:
|
|
|
|
Board();
|
2015-10-27 12:55:23 -05:00
|
|
|
Board(const Board& b);
|
2015-11-03 23:00:12 -06:00
|
|
|
vector<Board> getRecord() const{ return record; }
|
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-11-02 16:19:42 -06:00
|
|
|
bool checkTaken(char c);
|
|
|
|
vector<Piece*> getPieces() const { return pieces; }
|
|
|
|
vector<Piece*> getTypePieces(char type) const;
|
|
|
|
char getTurn() const { return turn; }
|
2015-10-19 15:36:20 -05:00
|
|
|
bool isGameOver();
|
2015-11-02 16:19:42 -06:00
|
|
|
char whoWon();
|
2015-10-19 15:36:20 -05:00
|
|
|
void changeTurns();
|
2015-11-02 16:19:42 -06:00
|
|
|
void resetTaken();
|
2015-10-19 15:36:20 -05:00
|
|
|
void displayBoard();
|
2015-10-27 11:51:37 -05:00
|
|
|
string boardToString();
|
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-11-03 23:00:12 -06:00
|
|
|
Board* undo();
|
2015-10-19 16:37:20 -05:00
|
|
|
void snapshot(vector<Board>& inputVec, Board inputBoard);
|
2015-11-02 16:19:42 -06:00
|
|
|
int evaluate(char max, char min);
|
2015-10-29 08:58:32 -05:00
|
|
|
};
|