unsing (repl.it) site
Exercise 2-Connect four 2D array Exercise Objectives passing 2-D arrays to functions Call by reference Problem Description 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, or a column before your opponent can do likewise. Inside your folder, create a project named "finalQ". Use this project to write and run a C program that repeatedly performs the following: Create a 2D array of character to store the game board Create a function named initBoard that takes as an argument at least a 7-column 2D array of characters and initializes the array with space . Create a function named printBoard that takes as an argument at least a 7-column 2D array of characters and properly print the board (as in the sample sun) Create a function named checkHorizontalWin that takes as an argument at least a 7-column 2D array of characters, row index (c), and a character representing the color of a particle player (p). The function should return 1 if the player (p) has four consecutive (y disks in row index r, and otherwise - Create a function named checkVericalWin that takes as an argument at least a 7-column 2D array of characters, a column index (c), and a character representing the color of a particle player (p). The function should return 1 if the player (p) has four consecutive [i] disks in column index c, and otherwise Create a function named checkDraw that takes as an argument at least a 7-column 2D array of characters, and return 1 if the result of the game draw (S) and otherwise Repeatedly prompts two players to drop a RED or YELLOW disk alternately. Whenever a disk is dropped, the program redisplays the board on the screen and determines the player wins, or if it is a draw, or continue. Here is a sample run (on the next page) Drop a red disk at column (0-6): 0 TR] Drop a yellow disk at column (0-6): 3 IRI TYI ... . Drop a yellow disk at column (0-6): 6 JYRYL ! IRIY|YY|Y| IRIYIRIYIRIRIRI The yellow player won