Question: Two maps are shown below. The one on the left gives the location of some dangerous chemical. The one on the right show the degree

Two maps are shown below. The one on the left gives the location of some dangerous chemical. The one on the right show the degree of safety. A location is considered to be safe (safety = 1) if there is no chemical around in 3 times 3 neighborhood, and a super safe location (safety = 2) has no chemical around is 5 times 5 neighbourhood. The shaded grid below shows a super location, within the borded neighbourhood. Assume the existence of the following 2D arrays: bool m [9] [9]; This is the chemical distribution map, where true denotes the existence of dangerous chemical, false otherwise. According to the above sample, m[0] [0] is true. int s[9] [9]; This stores the safety indicator at each position, where 2 is super safe, 1 is safe, 0 otherwise, According to the above sample, s[4] [4] = 2. Jack has constructed a function to compute the safety indicators, and is shown below. There are errors in his program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
