Question: C++ only connect4.cpp: #include connect4.h Connect4::Connect4() { ClearBoard(); } Connect4::~Connect4() { // Intentionally empty } void Connect4::ClearBoard() { // Initialize Connect4 board for (int c
The primary goal of this programming assignment is to give students experience using pre-existing classes. You will be given a Connect4 class (connect4.h and connect4.cpp) that represents the classic 6x7 Connect4 board using a 2D array of characters. The Connect4 class also provides methods to clear the board, let a player make a move, display the board, and finally check to see if one player has won the game. The Connect4 class definition from connect4.h is given below: Global constants const int WIN-4; const int ROWS6; const int COLS = 7; / Class definition class Connect4 public: // Constructor and destructor Connect4) -Connect4) // Public methods void ClearBoard) bool MakeMove(int col, char player); bool CheckWin (char player); void PrintBoard); private: Private variables char board[ ROWS ] [ COLS]; int count [ COLS Your task is to write an interactive program that will allow the user to play the Connect4 game against the computer. To do this, you must implement a "game loop that lets the user and the computer take alternate turns placing their pieces on the board until one player or the other wins the game (or there are no spaces left to play in). To keep things simple, your computer player (the game Al) should choose a column to play in at random. Your program should display the board after every move, so the player can plan their strategy for winning the game. You should be able to implement this interactive game without making any changes to the Connect4 class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
