#include #include "Player.h" #include "Gameboard.h" using namespace std; int main() { // Initialize game cout << "Welcome to TicTacToe!" << endl << endl; // Initialize gameboard Gameboard gameboard; // Initialize players Player player1(1); Player player2(2); // Do gameloop int endGame = 0; while(!endGame) { gameboard.printGameboard(); cout << player1.getName() << "'s turn:" << endl; gameboard.playMove(player1.getSymbol(),player1.getMoveY(),player1.getMoveX()); endGame = gameboard.checkWin(player1.getPlayerID(),player1.getSymbol()); if(endGame){break;} gameboard.printGameboard(); cout << player2.getName() << "'s turn:" << endl; gameboard.playMove(player2.getSymbol(),player2.getMoveY(),player2.getMoveX()); endGame = gameboard.checkWin(player2.getPlayerID(),player2.getSymbol()); } // Print winning player if(endGame == player1.getPlayerID()) { cout << player1.getName() << " Wins!" << endl; } if(endGame == player2.getPlayerID()) { cout << player2.getName() << " Wins!" << endl; } return 0; }