finished restructuring
This commit is contained in:
parent
d64552743a
commit
7859237ced
2 changed files with 439 additions and 793 deletions
837
Board.cpp
837
Board.cpp
|
@ -1,500 +1,499 @@
|
||||||
class Board
|
#include "Board.h"
|
||||||
|
|
||||||
|
Board::Board() {
|
||||||
|
for (int i = 0; i < 2; ++i) {
|
||||||
|
for (int j = 0; j < 8; ++j) {
|
||||||
|
boardArray[i][j] = 'X';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 2; i < 6; ++i) {
|
||||||
|
for (int j = 0; j < 8; ++j) {
|
||||||
|
boardArray[i][j] = '_';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 6; i <= 7; ++i) {
|
||||||
|
for (int j = 0; j < 8; ++j) {
|
||||||
|
boardArray[i][j] = 'O';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
moves Board::parse(string input)
|
||||||
{
|
{
|
||||||
char boardArray [8][8];
|
|
||||||
char turn = 'O';
|
|
||||||
|
|
||||||
public:
|
input = myToUpper(input);
|
||||||
|
|
||||||
Board()
|
cout<<input<<endl;
|
||||||
|
|
||||||
|
int temp1;
|
||||||
|
char temp2;
|
||||||
|
string temp3;
|
||||||
|
|
||||||
|
temp2 = input[0];
|
||||||
|
temp1 = input[1] - '0';
|
||||||
|
|
||||||
|
if (input[3] == 'L')
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 2; ++i)
|
temp3 = "LEFT";
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (input[3] == 'R')
|
||||||
|
{
|
||||||
|
temp3 = "RIGHT";
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
temp3 = "FWD";
|
||||||
|
}
|
||||||
|
|
||||||
|
moves output(temp1,temp2,temp3);
|
||||||
|
|
||||||
|
return output;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Board::isGameOver()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 8; ++i)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (boardArray[0][i] == 'O')
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 8; ++j)
|
cout<<"\n\n\nplayer O wins!\n\n\n"<<endl;
|
||||||
{
|
return true;
|
||||||
boardArray[i][j] = 'X';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (boardArray[7][i] == 'X')
|
||||||
for (int i = 2; i < 6; ++i)
|
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 8; ++j)
|
cout<<"\n\n\nplayer X wins!\n\n\n"<<endl;
|
||||||
{
|
return true;
|
||||||
boardArray[i][j] = '_';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
for (int i = 6; i <= 7; ++i)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < 8; ++j)
|
|
||||||
{
|
|
||||||
boardArray[i][j] = 'O';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
void Board::changeTurns()
|
||||||
}
|
{
|
||||||
|
if (turn == 'O') turn = 'X';
|
||||||
|
else turn = 'O';
|
||||||
|
}
|
||||||
|
|
||||||
moves parse(string input)
|
void BoarddisplayBoard()
|
||||||
|
{
|
||||||
|
cout<<"\n\n";
|
||||||
|
cout<<" A B C D E F G H"<<endl;
|
||||||
|
for (int i = 0; i < 8; ++i)
|
||||||
{
|
{
|
||||||
|
int mango = 8 - i;
|
||||||
input = myToUpper(input);
|
cout<<mango<<" ";
|
||||||
|
for (int j = 0; j < 8; ++j)
|
||||||
cout<<input<<endl;
|
|
||||||
|
|
||||||
int temp1;
|
|
||||||
char temp2;
|
|
||||||
string temp3;
|
|
||||||
|
|
||||||
temp2 = input[0];
|
|
||||||
temp1 = input[1] - '0';
|
|
||||||
|
|
||||||
if (input[3] == 'L')
|
|
||||||
{
|
{
|
||||||
temp3 = "LEFT";
|
cout<<boardArray[i][j]<<" ";
|
||||||
}
|
}
|
||||||
|
cout<<endl;
|
||||||
else if (input[3] == 'R')
|
|
||||||
{
|
|
||||||
temp3 = "RIGHT";
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
temp3 = "FWD";
|
|
||||||
}
|
|
||||||
|
|
||||||
moves output(temp1,temp2,temp3);
|
|
||||||
|
|
||||||
return output;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
cout<<'\n'<<endl;
|
||||||
|
cout<<"turn : "<<turn;
|
||||||
|
}
|
||||||
|
|
||||||
char getTurn()
|
int Board::charToIntColumn(char input) //converts column number to int
|
||||||
|
{
|
||||||
|
int kolumn;
|
||||||
|
|
||||||
|
switch (input)
|
||||||
{
|
{
|
||||||
return turn;
|
case 'A': kolumn = 0; break;
|
||||||
|
case 'B': kolumn = 1; break;
|
||||||
|
case 'C': kolumn = 2; break;
|
||||||
|
case 'D': kolumn = 3; break;
|
||||||
|
case 'E': kolumn = 4; break;
|
||||||
|
case 'F': kolumn = 5; break;
|
||||||
|
case 'G': kolumn = 6; break;
|
||||||
|
case 'H': kolumn = 7; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isGameOver()
|
return kolumn;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char Board::intToCharColumn(int input) //converts column number to int
|
||||||
|
{
|
||||||
|
char kolumn;
|
||||||
|
|
||||||
|
switch (input)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 8; ++i)
|
case 1: kolumn = 'A'; break;
|
||||||
{
|
case 2: kolumn = 'B'; break;
|
||||||
|
case 3: kolumn = 'C'; break;
|
||||||
if (boardArray[0][i] == 'O')
|
case 4: kolumn = 'D'; break;
|
||||||
{
|
case 5: kolumn = 'E'; break;
|
||||||
cout<<"\n\n\nplayer O wins!\n\n\n"<<endl;
|
case 6: kolumn = 'F'; break;
|
||||||
return true;
|
case 7: kolumn = 'G'; break;
|
||||||
}
|
case 8: kolumn = 'H'; break;
|
||||||
|
|
||||||
if (boardArray[7][i] == 'X')
|
|
||||||
{
|
|
||||||
cout<<"\n\n\nplayer X wins!\n\n\n"<<endl;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// else return false; this line was making this function return false no matter what, apparently...
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return kolumn;
|
||||||
|
}
|
||||||
|
|
||||||
void changeTurns()
|
void Board::move(string inputMove)
|
||||||
|
{
|
||||||
|
|
||||||
|
moves jugada = parse(inputMove);
|
||||||
|
|
||||||
|
int row = 8 - (jugada.row);
|
||||||
|
int kolumn = charToIntColumn(jugada.column);
|
||||||
|
int temp = boardArray[row][kolumn];
|
||||||
|
int reflector = 1;
|
||||||
|
|
||||||
|
if (row > 8 || row < 0 || kolumn > 8 || kolumn < 0)
|
||||||
{
|
{
|
||||||
if (turn == 'O') turn = 'X';
|
cout<<"ERROR: index out of bound!"<<endl;
|
||||||
else turn = 'O';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (temp != turn)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void displayBoard()
|
|
||||||
{
|
|
||||||
cout<<"\n\n";
|
|
||||||
cout<<" A B C D E F G H"<<endl;
|
|
||||||
for (int i = 0; i < 8; ++i)
|
|
||||||
{
|
|
||||||
int mango = 8 - i;
|
|
||||||
cout<<mango<<" ";
|
|
||||||
for (int j = 0; j < 8; ++j)
|
|
||||||
{
|
|
||||||
cout<<boardArray[i][j]<<" ";
|
|
||||||
}
|
|
||||||
cout<<endl;
|
|
||||||
}
|
|
||||||
cout<<'\n'<<endl;
|
|
||||||
cout<<"turn : "<<turn;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int charToIntColumn(char input) //converts column number to int
|
|
||||||
{
|
{
|
||||||
int kolumn;
|
cout<<"you can't move that piece at this turn!"<<endl;
|
||||||
|
|
||||||
switch (input)
|
|
||||||
{
|
|
||||||
case 'A': kolumn = 0; break;
|
|
||||||
case 'B': kolumn = 1; break;
|
|
||||||
case 'C': kolumn = 2; break;
|
|
||||||
case 'D': kolumn = 3; break;
|
|
||||||
case 'E': kolumn = 4; break;
|
|
||||||
case 'F': kolumn = 5; break;
|
|
||||||
case 'G': kolumn = 6; break;
|
|
||||||
case 'H': kolumn = 7; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return kolumn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (temp == '_')
|
||||||
char intToCharColumn(int input) //converts column number to int
|
|
||||||
{
|
{
|
||||||
char kolumn;
|
cout<<"there's no piece in that spot!"<<endl;
|
||||||
|
|
||||||
switch (input)
|
|
||||||
{
|
|
||||||
case 1: kolumn = 'A'; break;
|
|
||||||
case 2: kolumn = 'B'; break;
|
|
||||||
case 3: kolumn = 'C'; break;
|
|
||||||
case 4: kolumn = 'D'; break;
|
|
||||||
case 5: kolumn = 'E'; break;
|
|
||||||
case 6: kolumn = 'F'; break;
|
|
||||||
case 7: kolumn = 'G'; break;
|
|
||||||
case 8: kolumn = 'H'; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return kolumn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (temp == 'X' || temp == 'O')
|
||||||
|
|
||||||
void move(string inputMove)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
moves jugada = parse(inputMove);
|
if (temp == 'O')
|
||||||
|
|
||||||
int row = 8 - (jugada.row);
|
|
||||||
int kolumn = charToIntColumn(jugada.column);
|
|
||||||
int temp = boardArray[row][kolumn];
|
|
||||||
int reflector = 1;
|
|
||||||
|
|
||||||
if (row > 8 || row < 0 || kolumn > 8 || kolumn < 0)
|
|
||||||
{
|
{
|
||||||
cout<<"ERROR: index out of bound!"<<endl;
|
reflector *= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (temp != turn)
|
|
||||||
{
|
|
||||||
cout<<"you can't move that piece at this turn!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (temp == '_')
|
if (jugada.moveType == "FWD")
|
||||||
{
|
{
|
||||||
cout<<"there's no piece in that spot!"<<endl;
|
|
||||||
}
|
if(boardArray[row+reflector][kolumn] != '_')
|
||||||
|
|
||||||
else if (temp == 'X' || temp == 'O')
|
|
||||||
{
|
|
||||||
|
|
||||||
if (temp == 'O')
|
|
||||||
{
|
{
|
||||||
reflector *= -1;
|
cout<<"you can't move that piece forward"<<endl;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (jugada.moveType == "FWD")
|
|
||||||
{
|
|
||||||
|
|
||||||
if(boardArray[row+reflector][kolumn] != '_')
|
|
||||||
{
|
|
||||||
cout<<"you can't move that piece forward"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
boardArray[row][kolumn] = '_';
|
|
||||||
boardArray[row+reflector][kolumn] = temp;
|
|
||||||
|
|
||||||
changeTurns();
|
|
||||||
displayBoard();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (jugada.moveType == "LEFT")
|
|
||||||
{
|
|
||||||
if (kolumn == 0)
|
|
||||||
{
|
|
||||||
cout<<"Destination Spot out of range!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (boardArray[row+reflector][kolumn-1] == temp)
|
|
||||||
{
|
|
||||||
cout<<"you hate your own team or something? you can't do that!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
boardArray[row][kolumn] = '_';
|
|
||||||
boardArray[row+reflector][kolumn-1] = temp;
|
|
||||||
|
|
||||||
changeTurns();
|
|
||||||
displayBoard();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (jugada.moveType == "RIGHT")
|
|
||||||
{
|
|
||||||
if (kolumn == 7)
|
|
||||||
{
|
|
||||||
cout<<"Destination Spot out of range!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (boardArray[row+reflector][kolumn+1] == temp)
|
|
||||||
{
|
|
||||||
cout<<"you hate your own team or something? you can't do that!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
boardArray[row][kolumn] = '_';
|
|
||||||
boardArray[row+reflector][kolumn+1] = temp;
|
|
||||||
|
|
||||||
changeTurns();
|
|
||||||
displayBoard();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cout<<"Unrecognized movetype!"<<endl;
|
boardArray[row][kolumn] = '_';
|
||||||
}
|
boardArray[row+reflector][kolumn] = temp;
|
||||||
|
|
||||||
|
|
||||||
|
changeTurns();
|
||||||
|
displayBoard();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else if (jugada.moveType == "LEFT")
|
||||||
{
|
{
|
||||||
cout<<"Invalid piece!"<<endl;
|
if (kolumn == 0)
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void move(moves jugada)
|
|
||||||
{
|
|
||||||
|
|
||||||
int row = 8 - (jugada.row);
|
|
||||||
int kolumn = charToIntColumn(jugada.column);
|
|
||||||
|
|
||||||
if (row > 8 || row < 0 || kolumn > 8 || kolumn < 0)
|
|
||||||
{
|
|
||||||
cout<<"ERROR: index out of bound!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
int temp = boardArray[row][kolumn];
|
|
||||||
if (temp != turn)
|
|
||||||
{
|
|
||||||
cout<<"you can't move that piece at this turn!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (temp == '_')
|
|
||||||
{
|
|
||||||
cout<<"there's no piece in that spot!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
int reflector = 1;
|
|
||||||
|
|
||||||
if (temp == 'X' || temp == 'O')
|
|
||||||
{
|
|
||||||
|
|
||||||
if (temp == 'O')
|
|
||||||
{
|
{
|
||||||
reflector *= -1;
|
cout<<"Destination Spot out of range!"<<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (boardArray[row+reflector][kolumn-1] == temp)
|
||||||
if (jugada.moveType == "FWD")
|
|
||||||
{
|
{
|
||||||
|
cout<<"you hate your own team or something? you can't do that!"<<endl;
|
||||||
if(boardArray[row+reflector][kolumn] != '_')
|
|
||||||
{
|
|
||||||
cout<<"you can't move that piece forward"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
boardArray[row][kolumn] = '_';
|
|
||||||
boardArray[row+reflector][kolumn] = temp;
|
|
||||||
|
|
||||||
changeTurns();
|
|
||||||
displayBoard();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (jugada.moveType == "LEFT")
|
|
||||||
{
|
|
||||||
if (kolumn == 0)
|
|
||||||
{
|
|
||||||
cout<<"Destination Spot out of range!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (boardArray[row+reflector][kolumn-1] == temp)
|
|
||||||
{
|
|
||||||
cout<<"you hate your own team or something? you can't do that!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
boardArray[row][kolumn] = '_';
|
|
||||||
boardArray[row+reflector][kolumn-1] = temp;
|
|
||||||
|
|
||||||
changeTurns();
|
|
||||||
displayBoard();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (jugada.moveType == "RIGHT")
|
|
||||||
{
|
|
||||||
if (kolumn == 7)
|
|
||||||
{
|
|
||||||
cout<<"Destination Spot out of range!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (boardArray[row+reflector][kolumn+1] == temp)
|
|
||||||
{
|
|
||||||
cout<<"you hate your own team or something? you can't do that!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
boardArray[row][kolumn] = '_';
|
|
||||||
boardArray[row+reflector][kolumn+1] = temp;
|
|
||||||
|
|
||||||
changeTurns();
|
|
||||||
displayBoard();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cout<<"Unrecognized movetype!"<<endl;
|
boardArray[row][kolumn] = '_';
|
||||||
|
boardArray[row+reflector][kolumn-1] = temp;
|
||||||
|
|
||||||
|
changeTurns();
|
||||||
|
displayBoard();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (jugada.moveType == "RIGHT")
|
||||||
|
{
|
||||||
|
if (kolumn == 7)
|
||||||
|
{
|
||||||
|
cout<<"Destination Spot out of range!"<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (boardArray[row+reflector][kolumn+1] == temp)
|
||||||
|
{
|
||||||
|
cout<<"you hate your own team or something? you can't do that!"<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
boardArray[row][kolumn] = '_';
|
||||||
|
boardArray[row+reflector][kolumn+1] = temp;
|
||||||
|
|
||||||
|
changeTurns();
|
||||||
|
displayBoard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cout<<"Invalid piece!"<<endl;
|
cout<<"Unrecognized movetype!"<<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
bool isThisMovePossible(int r, int c, string moveType)
|
|
||||||
{
|
{
|
||||||
char pieceToMove = boardArray[r][c];
|
cout<<"Invalid piece!"<<endl;
|
||||||
|
}
|
||||||
if (pieceToMove != turn) //trying to move invalid piece
|
|
||||||
{
|
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
int reflector = 1;
|
void Board::move(moves jugada)
|
||||||
|
{
|
||||||
if (pieceToMove == 'O')
|
|
||||||
|
int row = 8 - (jugada.row);
|
||||||
|
int kolumn = charToIntColumn(jugada.column);
|
||||||
|
|
||||||
|
if (row > 8 || row < 0 || kolumn > 8 || kolumn < 0)
|
||||||
|
{
|
||||||
|
cout<<"ERROR: index out of bound!"<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
int temp = boardArray[row][kolumn];
|
||||||
|
if (temp != turn)
|
||||||
|
{
|
||||||
|
cout<<"you can't move that piece at this turn!"<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (temp == '_')
|
||||||
|
{
|
||||||
|
cout<<"there's no piece in that spot!"<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
int reflector = 1;
|
||||||
|
|
||||||
|
if (temp == 'X' || temp == 'O')
|
||||||
|
{
|
||||||
|
|
||||||
|
if (temp == 'O')
|
||||||
{
|
{
|
||||||
reflector *= -1;
|
reflector *= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (jugada.moveType == "FWD")
|
||||||
|
{
|
||||||
|
|
||||||
|
if(boardArray[row+reflector][kolumn] != '_')
|
||||||
|
{
|
||||||
|
cout<<"you can't move that piece forward"<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
boardArray[row][kolumn] = '_';
|
||||||
|
boardArray[row+reflector][kolumn] = temp;
|
||||||
|
|
||||||
|
changeTurns();
|
||||||
|
displayBoard();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (jugada.moveType == "LEFT")
|
||||||
|
{
|
||||||
|
if (kolumn == 0)
|
||||||
|
{
|
||||||
|
cout<<"Destination Spot out of range!"<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (boardArray[row+reflector][kolumn-1] == temp)
|
||||||
|
{
|
||||||
|
cout<<"you hate your own team or something? you can't do that!"<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
boardArray[row][kolumn] = '_';
|
||||||
|
boardArray[row+reflector][kolumn-1] = temp;
|
||||||
|
|
||||||
|
changeTurns();
|
||||||
|
displayBoard();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (jugada.moveType == "RIGHT")
|
||||||
|
{
|
||||||
|
if (kolumn == 7)
|
||||||
|
{
|
||||||
|
cout<<"Destination Spot out of range!"<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (boardArray[row+reflector][kolumn+1] == temp)
|
||||||
|
{
|
||||||
|
cout<<"you hate your own team or something? you can't do that!"<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
boardArray[row][kolumn] = '_';
|
||||||
|
boardArray[row+reflector][kolumn+1] = temp;
|
||||||
|
|
||||||
|
changeTurns();
|
||||||
|
displayBoard();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (moveType == "FWD")
|
cout<<"Unrecognized movetype!"<<endl;
|
||||||
{
|
}
|
||||||
|
}
|
||||||
if (boardArray[r+reflector][c] == '_') return true;
|
|
||||||
else return false;
|
else
|
||||||
|
{
|
||||||
|
cout<<"Invalid piece!"<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Board::isThisMovePossible(int r, int c, string moveType)
|
||||||
|
{
|
||||||
|
char pieceToMove = boardArray[r][c];
|
||||||
|
|
||||||
|
if (pieceToMove != turn) //trying to move invalid piece
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int reflector = 1;
|
||||||
|
|
||||||
|
if (pieceToMove == 'O')
|
||||||
|
{
|
||||||
|
reflector *= -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (moveType == "FWD")
|
||||||
|
{
|
||||||
|
|
||||||
|
if (boardArray[r+reflector][c] == '_') return true;
|
||||||
|
else return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
else if (moveType == "RIGHT")
|
||||||
|
{
|
||||||
else if (moveType == "RIGHT")
|
if (boardArray[r+reflector][c+1] != pieceToMove && (r+reflector >= 0) && (r+reflector <= 7) && (c+1 <= 7) ) return true;
|
||||||
{
|
|
||||||
if (boardArray[r+reflector][c+1] != pieceToMove && (r+reflector >= 0) && (r+reflector <= 7) && (c+1 <= 7) ) return true;
|
|
||||||
else return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (moveType == "LEFT")
|
|
||||||
{
|
|
||||||
if (boardArray[r+reflector][c-1] != pieceToMove && (r+reflector >= 0) && (r+reflector <= 7) && (c+1 >= 0) ) return true;
|
|
||||||
else return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
vector<moves> viewPossibleMoves()
|
|
||||||
{
|
|
||||||
vector<moves> output;
|
|
||||||
|
|
||||||
for (int r = 0; r < 8; ++r)
|
else if (moveType == "LEFT")
|
||||||
{
|
{
|
||||||
for (int c = 0; c < 8; ++c)
|
if (boardArray[r+reflector][c-1] != pieceToMove && (r+reflector >= 0) && (r+reflector <= 7) && (c+1 >= 0) ) return true;
|
||||||
{
|
else return false;
|
||||||
if (boardArray[r][c] == turn)
|
|
||||||
{
|
|
||||||
if (isThisMovePossible(r,c,"FWD"))
|
|
||||||
{
|
|
||||||
moves temp(8-r,intToCharColumn(c+1),"FWD");
|
|
||||||
output.push_back(temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isThisMovePossible(r,c,"LEFT"))
|
|
||||||
{
|
|
||||||
moves temp(8-r,intToCharColumn(c+1),"LEFT");
|
|
||||||
output.push_back(temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isThisMovePossible(r,c,"RIGHT"))
|
|
||||||
{
|
|
||||||
moves temp(8-r,intToCharColumn(c+1),"RIGHT");
|
|
||||||
output.push_back(temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
else return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
vector<moves> Board::viewPossibleMoves()
|
||||||
|
{
|
||||||
|
vector<moves> output;
|
||||||
|
|
||||||
|
for (int r = 0; r < 8; ++r)
|
||||||
void easyAI()
|
|
||||||
{
|
{
|
||||||
|
for (int c = 0; c < 8; ++c)
|
||||||
//1) see all possible movements
|
{
|
||||||
|
if (boardArray[r][c] == turn)
|
||||||
vector<moves> listOfMoves = viewPossibleMoves();
|
{
|
||||||
|
if (isThisMovePossible(r,c,"FWD"))
|
||||||
//2) pick a movement
|
{
|
||||||
|
moves temp(8-r,intToCharColumn(c+1),"FWD");
|
||||||
srand(time(NULL));
|
output.push_back(temp);
|
||||||
int randomChoice = rand() % (listOfMoves.size()-1) - 0; // choose a move betwen listOfMoves[0] to last element
|
}
|
||||||
|
|
||||||
//3) execute movement
|
if (isThisMovePossible(r,c,"LEFT"))
|
||||||
|
{
|
||||||
int temp = randomChoice;
|
moves temp(8-r,intToCharColumn(c+1),"LEFT");
|
||||||
|
output.push_back(temp);
|
||||||
move(listOfMoves[randomChoice]);
|
}
|
||||||
|
|
||||||
//cout<<"\n\nMove executed by AI: "<<listOfMoves[temp].column<<" "<<listOfMoves[temp].row<<" "<<listOfMoves[temp].moveType<<endl; uncomment for debugging purposes
|
if (isThisMovePossible(r,c,"RIGHT"))
|
||||||
|
{
|
||||||
|
moves temp(8-r,intToCharColumn(c+1),"RIGHT");
|
||||||
|
output.push_back(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
string Board::myToUpper(string input)
|
||||||
|
{
|
||||||
|
string output;
|
||||||
|
|
||||||
|
for (int i = 0 ; i < input.size(); ++i)
|
||||||
|
{
|
||||||
|
int numeric;
|
||||||
|
|
||||||
|
if ((input[i] - 0 >= 97) && (input[i] - 0 <= 122))
|
||||||
|
{
|
||||||
|
numeric = input[i] - 32;
|
||||||
|
output.push_back((char)numeric);// = 'Q';//(char) numeric;
|
||||||
|
}
|
||||||
|
else output.push_back(input[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < output.size(); ++i)
|
||||||
|
{
|
||||||
|
cout<<output[i]<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Board::displayPossibleMoves(vector<moves> input)
|
||||||
|
{
|
||||||
|
cout<<"\n\nList of possible Moves:"<<endl;
|
||||||
|
for (int i = 0; i < input.size(); ++i)
|
||||||
|
{
|
||||||
|
cout<<"possible move: "<<input[i].row<<" "<<input[i].column<<" "<<input[i].moveType<<endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Board::easyAI()
|
||||||
|
{
|
||||||
|
|
||||||
|
//1) see all possible movements
|
||||||
|
|
||||||
|
vector<moves> listOfMoves = viewPossibleMoves();
|
||||||
|
|
||||||
|
//2) pick a movement
|
||||||
|
|
||||||
|
srand(time(NULL));
|
||||||
|
int randomChoice = rand() % (listOfMoves.size()-1) - 0; // choose a move betwen listOfMoves[0] to last element
|
||||||
|
|
||||||
|
//3) execute movement
|
||||||
|
|
||||||
|
int temp = randomChoice;
|
||||||
|
|
||||||
|
move(listOfMoves[randomChoice]);
|
||||||
|
|
||||||
|
//cout<<"\n\nMove executed by AI: "<<listOfMoves[temp].column<<" "<<listOfMoves[temp].row<<" "<<listOfMoves[temp].moveType<<endl; uncomment for debugging purposes
|
||||||
|
|
||||||
|
}
|
395
Board.h
395
Board.h
|
@ -2,389 +2,36 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
struct moves {
|
||||||
|
int row;
|
||||||
|
char column;
|
||||||
|
string moveType;
|
||||||
|
|
||||||
|
moves(int linea, int columna, string m) {
|
||||||
|
row = linea;
|
||||||
|
column = columna;
|
||||||
|
moveType = m;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class Board {
|
class Board {
|
||||||
char boardArray [8][8];
|
char boardArray [8][8];
|
||||||
char turn = 'O';
|
char turn = 'O';
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Board();
|
Board();
|
||||||
|
|
||||||
moves parse(string input);
|
moves parse(string input);
|
||||||
|
|
||||||
char getTurn() { return turn; }
|
char getTurn() { return turn; }
|
||||||
|
|
||||||
bool isGameOver();
|
bool isGameOver();
|
||||||
void changeTurns();
|
void changeTurns();
|
||||||
void displayBoard();
|
void displayBoard();
|
||||||
|
int charToIntColumn(char input);
|
||||||
|
char intToCharColumn(int input);
|
||||||
int charToIntColumn(char input) //converts column number to int
|
void move(string inputMove);
|
||||||
{
|
void move(moves jugada);
|
||||||
int kolumn;
|
bool isThisMovePossible(int r, int c, string moveType);
|
||||||
|
vector<moves> viewPossibleMoves();
|
||||||
switch (input)
|
string myToUpper(string input);
|
||||||
{
|
void displayPossibleMoves(vector<moves> input);
|
||||||
case 'A': kolumn = 0; break;
|
void easyAI();
|
||||||
case 'B': kolumn = 1; break;
|
|
||||||
case 'C': kolumn = 2; break;
|
|
||||||
case 'D': kolumn = 3; break;
|
|
||||||
case 'E': kolumn = 4; break;
|
|
||||||
case 'F': kolumn = 5; break;
|
|
||||||
case 'G': kolumn = 6; break;
|
|
||||||
case 'H': kolumn = 7; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return kolumn;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char intToCharColumn(int input) //converts column number to int
|
|
||||||
{
|
|
||||||
char kolumn;
|
|
||||||
|
|
||||||
switch (input)
|
|
||||||
{
|
|
||||||
case 1: kolumn = 'A'; break;
|
|
||||||
case 2: kolumn = 'B'; break;
|
|
||||||
case 3: kolumn = 'C'; break;
|
|
||||||
case 4: kolumn = 'D'; break;
|
|
||||||
case 5: kolumn = 'E'; break;
|
|
||||||
case 6: kolumn = 'F'; break;
|
|
||||||
case 7: kolumn = 'G'; break;
|
|
||||||
case 8: kolumn = 'H'; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return kolumn;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void move(string inputMove)
|
|
||||||
{
|
|
||||||
|
|
||||||
moves jugada = parse(inputMove);
|
|
||||||
|
|
||||||
int row = 8 - (jugada.row);
|
|
||||||
int kolumn = charToIntColumn(jugada.column);
|
|
||||||
int temp = boardArray[row][kolumn];
|
|
||||||
int reflector = 1;
|
|
||||||
|
|
||||||
if (row > 8 || row < 0 || kolumn > 8 || kolumn < 0)
|
|
||||||
{
|
|
||||||
cout<<"ERROR: index out of bound!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (temp != turn)
|
|
||||||
{
|
|
||||||
cout<<"you can't move that piece at this turn!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (temp == '_')
|
|
||||||
{
|
|
||||||
cout<<"there's no piece in that spot!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (temp == 'X' || temp == 'O')
|
|
||||||
{
|
|
||||||
|
|
||||||
if (temp == 'O')
|
|
||||||
{
|
|
||||||
reflector *= -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (jugada.moveType == "FWD")
|
|
||||||
{
|
|
||||||
|
|
||||||
if(boardArray[row+reflector][kolumn] != '_')
|
|
||||||
{
|
|
||||||
cout<<"you can't move that piece forward"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
boardArray[row][kolumn] = '_';
|
|
||||||
boardArray[row+reflector][kolumn] = temp;
|
|
||||||
|
|
||||||
changeTurns();
|
|
||||||
displayBoard();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (jugada.moveType == "LEFT")
|
|
||||||
{
|
|
||||||
if (kolumn == 0)
|
|
||||||
{
|
|
||||||
cout<<"Destination Spot out of range!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (boardArray[row+reflector][kolumn-1] == temp)
|
|
||||||
{
|
|
||||||
cout<<"you hate your own team or something? you can't do that!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
boardArray[row][kolumn] = '_';
|
|
||||||
boardArray[row+reflector][kolumn-1] = temp;
|
|
||||||
|
|
||||||
changeTurns();
|
|
||||||
displayBoard();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (jugada.moveType == "RIGHT")
|
|
||||||
{
|
|
||||||
if (kolumn == 7)
|
|
||||||
{
|
|
||||||
cout<<"Destination Spot out of range!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (boardArray[row+reflector][kolumn+1] == temp)
|
|
||||||
{
|
|
||||||
cout<<"you hate your own team or something? you can't do that!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
boardArray[row][kolumn] = '_';
|
|
||||||
boardArray[row+reflector][kolumn+1] = temp;
|
|
||||||
|
|
||||||
changeTurns();
|
|
||||||
displayBoard();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cout<<"Unrecognized movetype!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cout<<"Invalid piece!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void move(moves jugada)
|
|
||||||
{
|
|
||||||
|
|
||||||
int row = 8 - (jugada.row);
|
|
||||||
int kolumn = charToIntColumn(jugada.column);
|
|
||||||
|
|
||||||
if (row > 8 || row < 0 || kolumn > 8 || kolumn < 0)
|
|
||||||
{
|
|
||||||
cout<<"ERROR: index out of bound!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
int temp = boardArray[row][kolumn];
|
|
||||||
if (temp != turn)
|
|
||||||
{
|
|
||||||
cout<<"you can't move that piece at this turn!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (temp == '_')
|
|
||||||
{
|
|
||||||
cout<<"there's no piece in that spot!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
int reflector = 1;
|
|
||||||
|
|
||||||
if (temp == 'X' || temp == 'O')
|
|
||||||
{
|
|
||||||
|
|
||||||
if (temp == 'O')
|
|
||||||
{
|
|
||||||
reflector *= -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (jugada.moveType == "FWD")
|
|
||||||
{
|
|
||||||
|
|
||||||
if(boardArray[row+reflector][kolumn] != '_')
|
|
||||||
{
|
|
||||||
cout<<"you can't move that piece forward"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
boardArray[row][kolumn] = '_';
|
|
||||||
boardArray[row+reflector][kolumn] = temp;
|
|
||||||
|
|
||||||
changeTurns();
|
|
||||||
displayBoard();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (jugada.moveType == "LEFT")
|
|
||||||
{
|
|
||||||
if (kolumn == 0)
|
|
||||||
{
|
|
||||||
cout<<"Destination Spot out of range!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (boardArray[row+reflector][kolumn-1] == temp)
|
|
||||||
{
|
|
||||||
cout<<"you hate your own team or something? you can't do that!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
boardArray[row][kolumn] = '_';
|
|
||||||
boardArray[row+reflector][kolumn-1] = temp;
|
|
||||||
|
|
||||||
changeTurns();
|
|
||||||
displayBoard();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (jugada.moveType == "RIGHT")
|
|
||||||
{
|
|
||||||
if (kolumn == 7)
|
|
||||||
{
|
|
||||||
cout<<"Destination Spot out of range!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (boardArray[row+reflector][kolumn+1] == temp)
|
|
||||||
{
|
|
||||||
cout<<"you hate your own team or something? you can't do that!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
boardArray[row][kolumn] = '_';
|
|
||||||
boardArray[row+reflector][kolumn+1] = temp;
|
|
||||||
|
|
||||||
changeTurns();
|
|
||||||
displayBoard();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cout<<"Unrecognized movetype!"<<endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cout<<"Invalid piece!"<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool isThisMovePossible(int r, int c, string moveType)
|
|
||||||
{
|
|
||||||
char pieceToMove = boardArray[r][c];
|
|
||||||
|
|
||||||
if (pieceToMove != turn) //trying to move invalid piece
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int reflector = 1;
|
|
||||||
|
|
||||||
if (pieceToMove == 'O')
|
|
||||||
{
|
|
||||||
reflector *= -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (moveType == "FWD")
|
|
||||||
{
|
|
||||||
|
|
||||||
if (boardArray[r+reflector][c] == '_') return true;
|
|
||||||
else return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (moveType == "RIGHT")
|
|
||||||
{
|
|
||||||
if (boardArray[r+reflector][c+1] != pieceToMove && (r+reflector >= 0) && (r+reflector <= 7) && (c+1 <= 7) ) return true;
|
|
||||||
else return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (moveType == "LEFT")
|
|
||||||
{
|
|
||||||
if (boardArray[r+reflector][c-1] != pieceToMove && (r+reflector >= 0) && (r+reflector <= 7) && (c+1 >= 0) ) return true;
|
|
||||||
else return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
else return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
vector<moves> viewPossibleMoves()
|
|
||||||
{
|
|
||||||
vector<moves> output;
|
|
||||||
|
|
||||||
for (int r = 0; r < 8; ++r)
|
|
||||||
{
|
|
||||||
for (int c = 0; c < 8; ++c)
|
|
||||||
{
|
|
||||||
if (boardArray[r][c] == turn)
|
|
||||||
{
|
|
||||||
if (isThisMovePossible(r,c,"FWD"))
|
|
||||||
{
|
|
||||||
moves temp(8-r,intToCharColumn(c+1),"FWD");
|
|
||||||
output.push_back(temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isThisMovePossible(r,c,"LEFT"))
|
|
||||||
{
|
|
||||||
moves temp(8-r,intToCharColumn(c+1),"LEFT");
|
|
||||||
output.push_back(temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isThisMovePossible(r,c,"RIGHT"))
|
|
||||||
{
|
|
||||||
moves temp(8-r,intToCharColumn(c+1),"RIGHT");
|
|
||||||
output.push_back(temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void easyAI()
|
|
||||||
{
|
|
||||||
|
|
||||||
//1) see all possible movements
|
|
||||||
|
|
||||||
vector<moves> listOfMoves = viewPossibleMoves();
|
|
||||||
|
|
||||||
//2) pick a movement
|
|
||||||
|
|
||||||
srand(time(NULL));
|
|
||||||
int randomChoice = rand() % (listOfMoves.size()-1) - 0; // choose a move betwen listOfMoves[0] to last element
|
|
||||||
|
|
||||||
//3) execute movement
|
|
||||||
|
|
||||||
int temp = randomChoice;
|
|
||||||
|
|
||||||
move(listOfMoves[randomChoice]);
|
|
||||||
|
|
||||||
//cout<<"\n\nMove executed by AI: "<<listOfMoves[temp].column<<" "<<listOfMoves[temp].row<<" "<<listOfMoves[temp].moveType<<endl; uncomment for debugging purposes
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
Reference in a new issue