Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C code, im in a hurry please Exercise 2 - Connect four 2D array Exercise Objectives Passing 2-D arrays to functions Call by reference Problem
C code, im in a hurry please
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 "finala". 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-coloumn 2D array of characters and initializes the array with a space Create a function named printBoard that takes as an argument at least a 7-coloumn 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-coloumn 2D array of characters, row index (r), and a character representing the color of a particle player (p). The function should return 1 if the player (p) has four consecutive (yi) disks in row index r, and 0 otherwise | Create a function named checkVericalWin that takes as an argument at least a 7-coloumn 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 (glais) disks in column index c, and 0 otherwise Create a function named checkDraw that takes as an argument at least a 7-coloumn 2D array of characters, and return 1 if the result of the game draw (J-Le) and 0 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) TI Drop a red disk at column (0-6): 0 11 TI |R| Drop a yellow disk at column (0-6): 3 RI Y| Drop a yellow disk at column (0-6): 6 TIITTIT | TITILITI TIL RITI | Y|RY| | | |RY|Y|YY| |RY|RY|R|R|R| The yellow player wonStep 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