-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain_for_game8.cpp
More file actions
40 lines (33 loc) · 1.28 KB
/
Copy pathmain_for_game8.cpp
File metadata and controls
40 lines (33 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
int main(){
// Set up the Ultimate Tic Tac Toe board
Game8_MainBoard* Board = new Game8_MainBoard();
// Choose game mode
int choice;
cout << "Choose game mode:\n";
cout << "1. Human vs Human\n";
cout << "2. Human vs Computer\n";
cin >> choice;
Player<char>* player1;
Player<char>* player2;
// Set up players based on choice
if (choice == 1) {
player1 = new Game8_Player("player 1", 'X');
player2 = new Game8_Player("player 2", 'O');
}
else if (choice == 2) {
player1 = new Game8_Player("player 1", 'X');
player2 = new Game8_RandomPlayer('O');
}
// Set the board for both players
player1->setBoard(Board);
player2->setBoard(Board);
// Create the game manager and run the game
Player<char>* players[2] = { player1, player2 };
GameManager<char>* gameManager = new GameManager<char>(Board, players);
gameManager->run();
// Clean up dynamically allocated memory
delete Board;
delete player1;
delete player2;
delete gameManager;
}