Answered step by step
Verified Expert Solution
Question
1 Approved Answer
connect 4 c++ using the following fields/methods. additional fields/methods can be added 13005 . V Chip class fields: color methods: Constructor int getColor() string toString()
connect 4 c++ using the following fields/methods. additional fields/methods can be added
13005 . V Chip class fields: color methods: Constructor int getColor() string toString() - returns an attractive string representation of itself Board class fields: 2D array of Chips - represents the game board (6 row by 7 column) ------ Example of part of a .h file with a 2D array --- class Board { private static const int SIZE COLUMNS = 7; static const int SIZE ROWS = 6; int board[SIZE_ROWS][SIZE_COLUMNS]; }; 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 chip in it and cells with a gold chip in it. int drop Chip(Chip, int) - drops a Chip 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 chip, G means gold chip) X X X X X X X X X X X X GX X X X X X RX X X X X X RX X RGG GRG 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 chips down slots in the board. You should represent the board after each chip drop. This should stop if there is a winner or if the board fills up. You should be turning in a Chip.h, Chip.cpp, Board.h, Board.cpp, Player.h, Player.cpp and a gamedriver.cpp that has your main in it. 13005 . V Chip class fields: color methods: Constructor int getColor() string toString() - returns an attractive string representation of itself Board class fields: 2D array of Chips - represents the game board (6 row by 7 column) ------ Example of part of a .h file with a 2D array --- class Board { private static const int SIZE COLUMNS = 7; static const int SIZE ROWS = 6; int board[SIZE_ROWS][SIZE_COLUMNS]; }; 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 chip in it and cells with a gold chip in it. int drop Chip(Chip, int) - drops a Chip 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 chip, G means gold chip) X X X X X X X X X X X X GX X X X X X RX X X X X X RX X RGG GRG 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 chips down slots in the board. You should represent the board after each chip drop. This should stop if there is a winner or if the board fills up. You should be turning in a Chip.h, Chip.cpp, Board.h, Board.cpp, Player.h, Player.cpp and a gamedriver.cpp that has your main in itStep 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