$35
COSC 326
Epidemic
Consider the following model of an epidemic in a grid-based universe. If at least two
of the four immediate neighbours of a cell are sick then it becomes, and remains sick.
The process continues until no further cells become sick. Some cells may be marked as
immune, and such cells can never become sick.
For instance (green cells are immune, yellow cells are sick):
Your task is basically to model this process.
Task
• Given an initial state of the universe, work out its final state. The universes will
be presented in text files consisting of sequences of lines all of the same length
made up of the characters I (for immune), S (sick), and . (for currently non-sick,
non-immune individuals). Each universe will be separated from the next by a
blank line. Output the final state of each universe in the same format.
• Given an initial universe containing only immune and vulnerable individuals,
determine the minimum number of individuals who must initially be made sick
so that eventually every non-immune individual becomes sick. This could be
a separate program or the same program running under a command line flag.
The output should be, for each universe, a number representing the number of
individuals who need to be made sick, and then a universe with that number of
sick individuals which would lead to all becoming sick.
(1 point, Individual)