Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( 1 ) Write a program that inputs a topographical map and outputs the locations that are in the shade, given a certain predetermined position
Write a program that inputs a "topographical" map and outputs the locations that are in the shade, given a certain predetermined position of the sun.
The input is an matrix representing evenly spaced points on a square piece of land. The values in the matrix are integers ranging from to Each value represents the "altitude" of the land at the corresponding point.
The output is an matrix of and where the output value is if the land at that point is in the sunlight and if the land at the point is in the shade.
Let us assume that the sun is shining from the west W A location is in the shade if there is a hill to its west high enough to block the sun. To compute which locations are in the shade: First, the locations in the leftmost column are by definition in the sunlight. For each remaining location i j it is in the shade if there is another location i whose altitude is at least greater than the altitude at i j This is an "exhaustive" search for different locations with different and
Step 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