Exercise 1. (100 points) Epidemic Model
In this exercise, we write code to simulate the spread of contagious diseases. In particular, we assume:
1. There are m hosts of a certain contagious disease.
2. These hosts are located on a two dimensional grid.
3. There are three different types of hosts:
(a) susceptible hosts - have not been infected by the disease
(b) infected hosts - have been infected by the disease and have not yet recovered
(c) recovered hosts - have recovered from the disease (Note: recovered hosts will not be infected by
the disease any more)
Initially there is a single infected host located at (0, 0), and the rest of the m − 1 hosts are susceptible hosts,
and they are randomly located on a 2D grid with edges that warp around (like Pacman). The center of the
grid is at (0, 0), and the four corners are at (−k, −k),(k, −k),(k, k) and (−k, k), respectively. When a host
moves outside of a border, they will appear on the opposite side. For example, if a host at (x, k) moves
up, they will appear at (x, −k), where −k <= x <= k. The hosts move according to a 2D random walk. Use
rand() % 4 to generate a direction according to the following mapping: