-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
35 lines (28 loc) · 710 Bytes
/
Copy pathmain.cpp
File metadata and controls
35 lines (28 loc) · 710 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
#include <iostream>
#include "Board.h"
using namespace std;
int main() {
Board game;
while (!game.done) {
system("clear");
std::cout << game << std::endl;
int x;
std::cout << std::endl;
std::cout << "Enter move for (" << (!game.playerTurn ? "X" : "O") << "): ";
std::cin >> x;
game.play(x);
}
system("clear");
std::cout << game << std::endl;
std::cout << std::endl;
if (game.hasWon(0)){
std::cout << "Player X has won" << std::endl;
}
else if (game.hasWon(1)){
std::cout << "Player O has won" << std::endl;
}
else {
std::cout << "It's a tie" << std::endl;
}
return 0;
}