Question: In this assignment, you will code a Java version of the game Connect Four. A picture of the real game is shown below. The game

In this assignment, you will code a Java version of the game Connect Four. A picture of the real game is shown below. The game is played by dropping disks down a slot. The disk stops when it hits the bottom of the board or hits another disk. Two players, one with red disks, one with black disks, alternate turns. The player wins if they get four in a row of their color (horizontal, vertical or diagonal). In the picture below, the player with the black disks wins because there are four on a diagonal.

Our game begins by drawing an empty board. Red plays first. They select a column. When the disk is entered, it drops to the bottom. Our game then redraws the board and then it is the black disk players turn. Each time the player selects a column, the disk drops as far as it can. A sequence of game play is shown below. Note there are 7 columns and 6 rows. You should create a ConnectFour class. This class should have an instance method void play(). (You should also create the necessary instance variables and additional private support instance methods.) You should create a driver class with a main method that simply creates a ConnectFour object (by calling a 0-argument constructor) and calls the play method on it. (Note: ideally you would create a class for Disk objects but the object is so simple that you may use chars if you prefer.)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!