-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathC4main.cpp
More file actions
29 lines (22 loc) · 888 Bytes
/
C4main.cpp
File metadata and controls
29 lines (22 loc) · 888 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
//Marya Poterek
//Main driver for C4 classes
//C4main.cpp
//CSE 20312
/* Main driver for both C4Col and C4Board classes, which instantiates object of class C4Board (and thus multiple objects of class C4Col via composition). This program calls member functions that facilitate game play, and directs the user's experience.
*/
#include<iostream>
#include "C4Board.h"
using namespace std;
int main() {
int turn = 1; //Begins with Player 1
int win = 0;
C4Board c; //Object of class C4Board, also constructs 7 objects of class C4Col
cout << "Welcome to Connect 4! Player 1 goes first!" << endl;
while (turn < 42 && win == 0) {
c.play(turn); //Play game, links to functions that place piece and check for win, etc.
c.display(); //Prints board after each turn
win = c.checkWin(turn);
turn++; //Increments after each play
}
return 0;
}