This repository has been archived on 2025-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
breakthroughpine64backup/Board.h
Rebecca Schofield 9dfa13b85d fixed undo
2015-11-03 23:00:12 -06:00

62 lines
1.3 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;
vector<Board> record;
bool valid, xtaken, otaken;
char turn = 'O';
public:
Board();
Board(const Board& b);
vector<Board> getRecord() const{ return record; }
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);
bool checkTaken(char c);
vector<Piece*> getPieces() const { return pieces; }
vector<Piece*> getTypePieces(char type) const;
char getTurn() const { return turn; }
bool isGameOver();
char whoWon();
void changeTurns();
void resetTaken();
void displayBoard();
string boardToString();
Board move(moves m);
bool isThisMovePossible(int r, int c, string moveType);
vector<moves> viewPossibleMoves();
string myToUpper(string input);
Board* undo();
void snapshot(vector<Board>& inputVec, Board inputBoard);
int evaluate(char max, char min);
};