Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(Game: connect four) Connect four is a two-player board game in which the player

ID: 3563458 • Letter: #

Question

(Game: connect four) Connect four is a two-player board game in which the
players alternately drop colored disks into a seven-column, six-row vertically
suspended grid, as shown below.
The objective of the game is to connect four same-colored disks in a row, a col-
umn, or a diagonal before your opponent can do likewise. The program prompts
two players to drop a red or yellow disk alternately. In the preceding figure, the
red disk is shown in a dark color and the yellow in a light color. Whenever a disk
is dropped, the program redisplays the board on the console and determines the
status of the game (win, draw, or continue). Here is a sample run:

| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |

Explanation / Answer

import java.util.Scanner; //This will be.. a huge code so we will have to make //lots of methods for each aspect of the game public class ConnectFour { //We need to first create the basic visual pattern public static String[][] createPattern() { //Although the game is more like a table of 6 //columns and 6 rows, we're going to have to make //a 2D array of 7 rows and 15 columns because graphically //there's an extra row to show the ___ at the bottom //and you have double the columns that show | | | //between each number String[][] f = new String[7][15]; //Time to loop over each row from up to down for (int i =0;i