Function Name: erosion
Inputs (3): - (double) An MxN array representing the heights of the topsoil in a particular area
- (double) An MxN array representing the heights of the bedrock in the same area underneath the topsoil
- (double) An erosion factor
Outputs (1): - (double) An MxN array representing the new heights of the topsoil with the applied erosion factor
Function Description:
Write a function that takes in arrays representing the heights of topsoil and bedrock of the same area and an erosion factor, and outputs the new heights of topsoil with the applied erosion factor. Assume that the topography is uniformly eroded by subtracting the erosion factor from each element of the topsoil array. Since topsoil erodes much more easily than bedrock, the erosion factor can completely erode the topsoil but should not affect the bedrock. For example, for a particular spot that has a topsoil of 34, bedrock of 0, and erosion factor of 26, the new height should be 10 and not 8.
Comments
Leave a comment