-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathproject2.cpp
More file actions
64 lines (55 loc) · 1.31 KB
/
Copy pathproject2.cpp
File metadata and controls
64 lines (55 loc) · 1.31 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <iostream>
using namespace std;
//Constant Variables
const int COLUMNS = 7;
const int ROWS = 6;
const int AI_1 = 1;
const int AI_2 = 2;
const int DEPTH_2 = 2;
const int DEPTH_4 = 4;
const int DEPTH_8 = 8;
//Variables
char board[ROWS][COLUMNS];
int currentPlayer = AI_1;
int turns = 0;
bool gameOver = false;
//Function Prototypes
void initalizeBoard();
void displayBoard(char [ROWS][COLUMNS]);
int main(){
initalizeBoard();
displayBoard(board);
return 0;
}
//Function Definitions
void initalizeBoard(){
for(int r = 0; r < ROWS; r++){
for(int c = 0; c < COLUMNS; c++){
board[r][c] = 0;
}
}
}
void displayBoard(char b[ROWS][COLUMNS]){
for(int i = 1; i <= COLUMNS; i++){
cout << " " << i;
}
cout << endl << "---------------" << endl;
for(int r = 0; r < ROWS; r++){
for(int c = 0; c < COLUMNS; c++){
cout << "|";
switch(board[ROWS - r - 1][c]){
case 0: cout << " ";
break;
case 1: cout << "O";
break;
case 2: cout << "X";
break;
}
if(c + 1 == COLUMNS){
cout << "|";
}
}
cout << endl;
}
cout << "---------------" << endl << endl;
}