Question
I want to make a code using C++ that can read the text file as an input. An example: and can generate the following results.
I want to make a code using C++ that can read the text file as an input. An example:
and can generate the following results. An example
For this project you will be designing and implementing a system, in either C or C++, to simulate an outbreak across a geographic area. Specifically, you will be using a cellular automata, with a Moore neighborhood configuration, to model a geographic region, and a SIR model to model the health states of the populace. Your model should visually output how the regions population changes over time, the final S, I, R, V counts, the day of the outbreaks peak, and the day the outbreak ended.
Your program must provide the following functionality and adhere to the following constraints: Allow the user to choose the file describing the initial setup of the simulation o The first line indicates the required number of infectious agents in a susceptible agents neighborhood for the susceptible agent to become infectious on the next day o The second line indicates how many days an agent remains infectious before it becomes recovered on the following day, i.e. if the infectious period is 2, then the agent becomes recovered after being infectious for 2 days o The third line indicates the display frequently for how frequently the region should be displayed in days o All subsequent lines will indicate the starting health states of the different agents in the region s: susceptible i: infectious r: recovered v: vaccinated Agents that are one square away from some other agent are considered to be in that agents neighborhood Agents on the left and right boundaries of the region should be considered adjacent, i.e. the region is not a flat map but more like a cylinder An agent can have one of four health states: susceptible, infectious, recovered, vaccinated o An agent can only move through the states as follows: S -> I -> R o A susceptible agent becomes infectious if they have threshold or greater number of infectious agents in their neighborhood on any given day o An infectious agent becomes recovered after infectious period number of days o Vaccinated agents are permanently vaccinated and cannot change states The simulation should run until the number of infectious agents is 0, indicating the outbreak has ended. There should only be S, R, and/or V agents left over The initial setup of the region represents the simulation at day 0 Your program should output the following: o The initial status of the region, i.e. day 0 o The status of the region every X days, where X is the display frequency from the input file o The final state of the region once the outbreak has ended, i.e. the first day that there are 0 infectious agents o The final counts of the number of susceptible, infectious, recovered, and vaccinated agents once the outbreak has ended, i.e. the first day that there are 0 infectious agents o The day the outbreak ended o The first day of the outbreaks peak in terms of number of infectious agents, i.e. the first day with the highest count of infectious agents Your code must be well commented. You must provide a short README file which includes your name and explains how to compile and run your program. Additionally, you may write a makefile if you want your code to compile with additional flags
Example Input:
Threshold:1 Infectious Period:2 Display:1 s,s,s,s,s,s,s,s,s,s s,s,s,s,s,s,s,s,s,s s,s,s,s,s,s,s,s,s,s s,s,s,s,s,s,s,s,s,s s,s,s,s,i,i,s,s,s,s s,s,s,s,i,i,s,s,s,s s,s,s,s,s,s,s,s,s,s s,s,s,s,s,s,s,s,s,s s,s,s,s,s,s,s,s,s,s s,s,s,s,s,s,s,s,s,s
Example Output:
Day 0 s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s i i s s s s s s s s i i s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s s
Day 2 s s s s s s s s s s s s s s s s s s s s s s i i i i i i s s s s i i i i i i s s s s i i r r i i s s s s i i r r i i s s s s i i i i i i s s s s i i i i i i s s s s s s s s s s s s s s s s s s s s s s
Day 4 i i i i i i i i i i i i i i i i i i i i i i r r r r r r i i i i r r r r r r i i i i r r r r r r i i i i r r r r r r i i i i r r r r r r i i i i r r r r r r i i i i i i i i i i i i i i i i i i i i i i
Day 6 r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r
Outbreak Ends: Day 6 Peak Day: Day 4 S: 0 I: 0 R: 100 V: 0
input1.txt - Notepad File Edit Format View Threshold:1 Infectious Period:2 Display:2 S, S,s, S,S,5,S, 5, 5,s S, S,s, S,S,5,S, 5, 5,s S, S,s, S,S,5,S, 5, 5,s S,s,s, S,S,5,S, 5, S,s s,s,s,s,i,i,s,s,s,s s,s,s,s,i,i,s,s,s,s S,S,S, S,S,5,S, 5, 5,s S, S,S, S,S,5,S, 5, 5,s S, S,s, S,S,5,S, 5, 5,s S, S,s, S,S,5,S,5, 5,S Help input1.txt - Notepad File Edit Format View Threshold:1 Infectious Period:2 Display:2 S, S,s, S,S,5,S, 5, 5,s S, S,s, S,S,5,S, 5, 5,s S, S,s, S,S,5,S, 5, 5,s S,s,s, S,S,5,S, 5, S,s s,s,s,s,i,i,s,s,s,s s,s,s,s,i,i,s,s,s,s S,S,S, S,S,5,S, 5, 5,s S, S,S, S,S,5,S, 5, 5,s S, S,s, S,S,5,S, 5, 5,s S, S,s, S,S,5,S,5, 5,S HelpStep 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