#include "fiveInARow.h" int Player::toInt(char input) { if ('1' <= input && input <= '9') { return input - '1'; } else if ('A' <= input && input <= 'F') { return input - 'A' + 9; } else if ('a' <= input && input <= 'f') { return input - 'a' + 9; } else { return -1; } } Player::Player(std::string name, bool type, ChessBoard *chessBoard) { this->playerName = name; this->chessType = type; this->board = chessBoard; } Player::~Player() { } std::string Player::getName() { return this->playerName; } bool Player::getColor() { return this->chessType; } putChessPieceResult Player::setChess(char row, char column) { int rowCount, columnCount; rowCount = toInt(row); columnCount = toInt(column); if (!this->board->setChess(chessType, rowCount, columnCount)) { return failed; } if (this->board->checkWinner(rowCount, columnCount, this->chessType)) { std::cout << "\n####################\n" << this->playerName << " wins!" << std::endl << "####################\n"; return win; } if (this->board->isFull()) { std::cout << "Board is full. Tie!" << std::endl; return fullBoard; } else { return success; } }