PROGRAM DESCRIPTION: The purpose of this programming project is to write a C++ program to build the software infrastructure that will allow you to build a simplified version of the \"Candy Crush game called \"1030 Crush\" where the goal is to match a combination of three or more characters to gain points in a finite set of moves or duration of time. REQUIREMENTS: As with all programs in this course, your program\'s output should initially display the department and course number, your name, your EUID, and your e-mail address. This functionality will be implemented using a function. To start the game, you will display an introductory message, implemented as a function, which will give details about the game. You will declare a two-dimensional array in main to represent the 9 x 9 board m type to represent the various values that a position on the board may as an assume. You will declare a global constant for the size of the 2D array (where rows columns) Each position on the board may be displayed as one of the following six values (corresponding to their enumerated data type) as follows: double quote exclamation point dollar sign hashtag ampersand percentage Note that these six characters can be found on the ASCII Table having continuous values between 33 and 38, inclusively. The e for the data type of the board will be declared as a global enumerated data type. You will initialize the board using a function, passing in the two-dimensional array and size (i.e., number of rows). This function will randomly initialize each position on the board to one of the 6 character values. You must make sure to seed the random number generator. You will also write a function to display the game board, passing in the two dimensional array and size (i.e., number of rows) This function will be invoked anytime the board has been updated (for this homework assignment, it is only invoked after the board has been initialized). This function will display the row and column headers for the board as well as the board itself (see SAMPLE OUTPUT) Your functions should receive as arguments only the minimally needed ones of the appropriate type, and should return a value of the appropriate type whenever
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
//FUNCTION: Draw the Board
int drawBoard()
{
//Declare array size
int board[9][9];
//initialize variables
int rows, columns, randomNumber, flag;
//random number seed generator
srand(time(NULL));
for ( rows = 0 ; rows < 9 ; rows++ )
{
for ( columns = 0 ; columns < 9 ; columns++ )
{
flag = 0;
do
{
//generate random numbers from 2 - 8
randomNumber = rand() %7 + 2;
board[rows][columns] = randomNumber;
//Checks for 2 adjacent numbers.
if ( board[rows][columns] == board[rows - 1][columns] || board[rows][columns] == board[rows][columns - 1] )
{
flag = 0;
continue;
}
else
//Prints the correct board
{
flag = 1;
printf( \" %d \", board[rows][columns] );
}
} while ( flag == 0 );
}//end inner for-loop
printf(\"\ \ \");
}//end outer for-loop
}//end FUNCTION drawBoard
//FUNCTION: Mark the surrounding of the number with \"|\" and \"_\" at board[5][5]
void marker( int a )
{
printf( \" _ \ \" );
printf( \"|%c|\ \", a );
printf( \" _ \ \" );
}
int main()
{
drawBoard();
}