77 lines
1.4 KiB
C++
Executable file
77 lines
1.4 KiB
C++
Executable file
#pragma once
|
|
|
|
#include <iostream>
|
|
#include <vector>
|
|
|
|
using namespace std;
|
|
|
|
struct moves {
|
|
int row;
|
|
char column;
|
|
string moveType;
|
|
|
|
moves(int linea, int columna, string m) {
|
|
row = linea;
|
|
column = columna;
|
|
moveType = m;
|
|
}
|
|
};
|
|
|
|
struct simpleBoard{
|
|
|
|
char boardStamp [8][8];
|
|
|
|
char elementAt(int r, int k)
|
|
{
|
|
return boardStamp[r][k];
|
|
}
|
|
|
|
void modifyAt(int r, int k, char c)
|
|
{
|
|
boardStamp[r][k] = c;
|
|
}
|
|
|
|
void display()
|
|
{
|
|
for (int r = 0; r < 8; ++r)
|
|
{
|
|
cout<<'\n';
|
|
|
|
for (int k = 0; k < 8; ++k)
|
|
{
|
|
cout<<boardStamp[r][k]<<" ";
|
|
}
|
|
}
|
|
}
|
|
|
|
};
|
|
|
|
class Board {
|
|
char boardArray [8][8];
|
|
char turn = 'O';
|
|
vector<simpleBoard> record;
|
|
|
|
public:
|
|
Board();
|
|
char elementAt(int r, int k) { return boardArray[r][k]; }
|
|
void modifyAt(int r, int k, char input) { boardArray[r][k] = input; }
|
|
moves parse(string input);
|
|
char getTurn() { return turn; }
|
|
bool isGameOver();
|
|
void changeTurns();
|
|
void displayBoard();
|
|
int charToIntColumn(char input);
|
|
char intToCharColumn(int input);
|
|
void move(string inputMove);
|
|
void move(moves jugada);
|
|
bool isThisMovePossible(int r, int c, string moveType);
|
|
vector<moves> viewPossibleMoves();
|
|
string myToUpper(string input);
|
|
void displayPossibleMoves(vector<moves> input);
|
|
void undo();
|
|
void interpret(string input, Board& tablero);
|
|
void snapshot();
|
|
void easyAI();
|
|
string boardToString();
|
|
void displayRecord();
|
|
};
|