Question
computer language C++ (Connect 4 game)( this is all the info that was givin no input or solution) I used the most recent version of
computer language C++ (Connect 4 game)( this is all the info that was givin no input or solution) I used the most recent version of Microsoft visual studio for this program)
Your solution must have these classes and at least these fields / methods. Your program must use the methods described in a meaningful fashion. You can create additional fields or methods but these the below should be core methods in your solution.
Checkers class
fields:
color
methods:
Constructor
int getColor()
string toString() - returns an attractive string representation of itsel
f Board class
fields:
2D array of checkers - represents the game board (6 row by 7 column)
methods:
constructor string toString() - returns an attractive string representation of itself
This needs to be an attractive table representation of the game board with aligned rows / columns with characters representing blank cells, cells with a red checkers in it and cells with a gold checkers in it
. int dropChecker(Checker, int) - drops a checker object down a particular slot. Returns an int indicating success or not. int isWinner() - returns code number representing no winner or player number of winner
Player class
fields:
name
color
methods:
Constructor
get / set methods for fields string toString() - string representation of itself. Example String representation of the board (X means blank, R means red checker, G means gold checker)
X X X X X X X
X X X X X X X
X X X X X G X
X X X X X R X
X X X X X R X
X R G G G R G
Main Your program should create two Players and a Board. It should represent the initial Board to the screen. You should then alternate between player 1 and player 2 and randomly drop checkers down slots in the board. You should represent the board after each checker drop. This should stop if there is a winner or if the board fills up. You should be turning in a Checker.h, Checker.cpp, Board.h, Board.cpp, Player.h, Player.cpp and a main.cpp
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started