CONTAGIOUS DISEASE SIMULATION

Ace your studies with our custom writing services! We've got your back for top grades and timely submissions, so you can say goodbye to the stress. Trust us to get you there!


Order a Similar Paper Order a Different Paper

CONTAGIOUS DISEASE SIMULATION

In this take-home exam, your task is to simulate the contagion process of an infectious disease. The environment will be provided as a 10×10 grid. Each cell of the grid will contain one of the characters ‘H’, ‘I’, and ‘-‘, where ‘H’ stands for a healthy, ‘I’ for an infected person. ‘-‘ means that this cell is not occupied by any person; in other words, it is empty.

In each step of the simulation (for each generation), an infected person will infect all of his/her nearby healthy people. They can only infect through the directions of up, down, right, and left. Diagonal infection is not possible.

The number of simulation steps is going to be provided as an input, and you will run the simulation accordingly. You will print the state of the grid after the last simulation step has completed.

While you are computing the next generation, you will consider only the state of the PREVIOUS generation.

INPUT FORMAT:

After each row of the grid, a new line ‘n’ character will be given. After reading the grid, you should read the number of simulations from the input.

Writerbay.net

Looking for top-notch essay writing services? We've got you covered! Connect with our writing experts today. Placing your order is easy, taking less than 5 minutes. Click below to get started.


Order a Similar Paper Order a Different Paper