Question: a code for me // Given includes - DO NOT include anything else #include #include #include #include project_utils.h // Prototypes for given functions (given

Project 1 - Fire vs Water CS 211, Spring 2024 Project SummaryI strongly suggest reading all of the instructions before starting, and toget a sense of how the project will execute by understanding andgetting credit for Milestone 0 before starting to program your solution. Inthis project we will use simulations to explore a paired down versionof a real world issue, the spread of fire across grasslands. Specifically,

 

a code for me 

// Given includes - DO NOT include anything else

#include

#include

#include

#include "project_utils.h"


 

// Prototypes for given functions (given as stubs)

void displayGrid(int r, int c, int g[][c]);

void spread(int r, int c, int g[][c], int spreadWhat);


 

// Additional Function Decomposition Prototypes



 

int main()

{

// set up random number generator based on project settings

srand(RAND_SEED);


 

// Acquire the simulation count from input

int simCount = 0;

 

// Acquire the simulation count from input

scanf("%d", &simCount);

 

// grid setup

int cols = -1;

int rows = -1;


 

// initialize grid size based on input values

scanf("%d %d", &rows, &cols);

int grid[rows][cols];



 

// TODO: Initialize the 2D grid

 


 

// Output initial program details

printf("Fire vs Water - %d Simulations!\n", simCount);


 

// output the initial grid

displayGrid(rows, cols, grid);


 

 

// TODO: execute however many simulations were requested

// NOTE: FIRE attempts to spread first, then WATER attempts to spread


 

// TODO: redraw the updated grid to the screen

 


 

// pause for animation

animate();




 

// TODO: print the stats after all simulations are complete

 

return 0;

}


 

void displayGrid(int r, int c, int g[][c])

{

clearScreen();


 

// TODO: implement and use the given project utility printCell function

}


 

void spread(int r, int c, int g[][c], int spreadWhat)

{

// TODO: implement

}

Project 1 - Fire vs Water CS 211, Spring 2024 Project Summary I strongly suggest reading all of the instructions before starting, and to get a sense of how the project will execute by understanding and getting credit for Milestone 0 before starting to program your solution. In this project we will use simulations to explore a paired down version of a real world issue, the spread of fire across grasslands. Specifically, we utilize a two-dimensional grid filled with specific states to simulate the spread of fire and water throughout the grid. Program and Coding Restrictions Any hard coding, especially to pass test cases, will result in a zero for the entire project. You cannot use any libraries beyond the ones we have given. You cannot use pointers or any dynamic memory allocations. We have given you a lot of code, use the provided code as a baseline and use the provided utility functions. Primary Project Topics printf & scanf 2D Arrays Input Redirection Function Decomposition Enumerations Randomness Given Files We have provided many files through the advanced zyBooks IDE. The primary implementation

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 Algorithms Questions!