Hans Friedrich began their career in 2006 as the Chief Technology Officer for Turing. Hans then moved on to A Hundred Years in 2012 as a Creative Technologist, where they served as a consultant and helped pitch and win large projects. In 2014, they became the Head of Engineering at Bletchley Park, where they were responsible for building web and mobile applications for a range of clients.
#include "../headers/Game.h"
Game::Game()
{
}
Game::~Game()
{
delete board;
delete player1;
delete player2;
}
void Game::initGame(int boardSize, int winLenght, int player1Type, int player2Type, int player1Color, int player2Color)
{
board = new Board(boardSize, winLenght);
player1 = new Player(player1Type, player1Color);
player2 = new Player(player2Type, player2Color);
currentPlayer = player1;
gameEnded = false;
gameWon = false;
gameDraw = false;
}
void Game::switchPlayer()
{
if (currentPlayer == player1)
currentPlayer = player2;
else
currentPlayer = player1;
}
bool Game::makeMove(int x, int y)
{
if (board->makeMove(x, y, currentPlayer->getColor()))
{
if (board->checkWin(x, y))
{
gameWon = true;
gameEnded = true;
return true;
}
else if (board->checkDraw())
{
gameDraw = true;
gameEnded = true;
return true;
}
switchPlayer();
return true;
}
else
return false;
}
bool Game::getGameEnded()
{
return gameEnded;
}
bool Game::getGameWon()
{
return gameWon;
}
bool Game::getGameDraw()
{
return gameDraw;
}
int Game::getCurrentPlayerColor()
{
return currentPlayer->getColor();
}
int Game::getCurrentPlayerType()
{
return currentPlayer->getType();
}
int Game::getBoardSize()
{
return board->getSize();
}
int Game::getWinLenght()
{
return board->getWinLenght();
Sign up to view 4 direct reports
Get started