forked from CIS-25-F25-BCC/tic-tac-toe
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
39 lines (29 loc) · 948 Bytes
/
Copy pathmain.cpp
File metadata and controls
39 lines (29 loc) · 948 Bytes
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
#include "TicTacToe.h"
#include <iostream>
int main() {
TicTacToe game;
std::cout << "Tic-Tac-Toe Game Demo\n";
std::cout << "=====================\n\n";
std::cout << "Initial board:\n";
std::cout << game.toString() << "\n";
// Play a sample game
std::cout << "X moves to (0, 0):\n";
game.makeMove(0, 0);
std::cout << game.toString() << "\n";
std::cout << "O moves to (1, 1):\n";
game.makeMove(1, 1);
std::cout << game.toString() << "\n";
std::cout << "X moves to (0, 1):\n";
game.makeMove(0, 1);
std::cout << game.toString() << "\n";
std::cout << "O moves to (2, 2):\n";
game.makeMove(2, 2);
std::cout << game.toString() << "\n";
std::cout << "X moves to (0, 2) - X wins!\n";
game.makeMove(0, 2);
std::cout << game.toString() << "\n";
if (game.getWinner() != ' ') {
std::cout << "Winner: " << game.getWinner() << "\n";
}
return 0;
}