Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Connect 4 with 2 players in c++ that contains the following Chip class Fields: Color Methods: Constructor int getColor() string toString() that returns an attractive

Connect 4 with 2 players in c++ that contains the following Chip class Fields: Color Methods: Constructor int getColor() string toString() that returns an attractive string representation of itself ie. string "R" for a red chip and string "G" for gold chip

Board class: Fields: 2d array of Chips (row of 6 by 7 collumns) Methods: Constructor string toString() this needs to be an attractive table representation of the board with rows and columns blank cells, cells with red Chips, and cells with gold Chips int dropChip(Chip,int) drops Chip object down a slot intWinner() that returns the winner or say that there is no winner

Player class Fields: Name Color Methods Constructor Get/set methods for fields string toString() that returns name:color for example Robert:Gold

Main Creates 2 players and the board Turns alternate between players 1 and 2 and asks to drop chips in slots The board should be displayed after each turn Winner is determined by getting 4 chips in a row vertically, horizontally, or diagonally The should stop once there is a winner or if the board fills up

additional classes/methods/Fields can be added if needed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions