I assume replacing a wall means the removing of a hole/light source. The requirements then are to restore the light intensities to what they were before the hole was made and to consider any changes...
Type: Posts; User: Norm
I assume replacing a wall means the removing of a hole/light source. The requirements then are to restore the light intensities to what they were before the hole was made and to consider any changes...
Is that comparing the square at x,y with its adjacent squares and using the value - 1 of the light intensity of the square at x,y?
For testing I'd recommend a small 2D array with a given hole. Run...
There are up to 8 near adjacent spaces. What is the level that is to be set for those squares?
What about the next set of spaces in the surrounding ring? and the next one out?
What happens when at...
If you know how the light spreads, you should be able to describe the algorithm in words to get a design for writing the code.
What are you trying to get from this thread? I thought you wanted to...
That's what we've been working on. Start with this one question:
What are the rules for setting the lightedness for squares when there is a light source (hole) at a square in the array?
That would be a part of the algorithm.
If you have the algorithm for how to set the intensity for squares when a hole is made,
and have written the code for it,
can you explain what your problem is?
So, the code is working with 2D arrays.
What are the rules for setting the lightedness for squares when there is a light source (hole) at a square in the array?
How do those rules change when...
Will the code be working with 2D arrays?
Then it should be easier when talking about what the code is supposed to do to use 2D arrays of digits as I posted in post#20
Sorry, I don't connect to...
I think it'd be easier to visualize if you used a 2D array of digits to show the light intensities for each square.
For example:
00100
00300
13531
00300
00100
What is the algorithm for computing the intensity for adjacent squares?
Can you give an example of a square that has two holes near it, one closer than the other on different sides.
Does what...
That would mean that there would have to be several passes made for a square to see which hole is closer and brighter to know which hole to use to set the light for that square.
Seems like the...
Would the light intensity be decreased for each "ring" of squares around the hole?
The first ring could have 8 squares.
The next ring could have 18(?) squares
The next ring could have 26(?)...
Does that mean the light goes past the adjacent squares? What determines how many squares it goes to?
Ok. If there is a hole, the light shines full strength there and with a -1 power at the (up to) 8 adjacent squares.
Ok, what needs to be considered as you work on the logic for the program?
What determines what spaces are lite by other sources? How will the code detect that condition and react correctly?
What logic does the code need to do that?
Can you explain the logic that you are trying to write code for?
For example what does this mean:
What is a "corrrect update" and how is it related to the light power?