[Community Puzzle] Lumen


#21

Same thing here, even after removing anything fancy, just using a couple for loops. All tests pass, but validators 5 and 6 fail. No idea why.


#22

Don’t forget that the light goes in every direction :

X X X X X
X X X X X
X X C X X
X X X X X
X X X X X

with a light of 4 will become

2 2 2 2 2
2 3 3 3 2
2 3 4 3 2
2 3 3 3 2
2 2 2 2 2

#23

Just a little suggestion: think before code. It wasn’t asked how strong the light on each cell is. You only need to know which cells have any light (or more accurately: how many cells are totally dark). If you consider this, it’ll be a pretty easy puzzle, no real need for recursion, BFS or anything special :slight_smile:

Happy coding!


#24

Thanks for that neat little puzzle that showed once again that the simplest solution is in most cases also the best.


#25

Thanks for that puzzle. A friend gave me a new idea to determinate light level and it solved 5 and 6 problems. (Java)


#27

Finally i found it !
my problem was not about comprehension of the problem, but about how i evaluate the distance between candles and cells. I try the classic sqrt((x1-x2)²+(y1-y2)²) and this solution works surprisingly well on all the test cases except validation 5 and 6… I hope it will help !


#28

Have to say I enjoyed this puzzle.

I didn’t use recursion as much as a few nested loops after identifying light sources, intensities, and cellar bounds.

I agree that this feels like the top end of the easy level in so far as my prior experiences go with these puzzles.

While I realized that light intensities don’t necessarily have to play a part here, I think it was interesting to consider when putting up the solution.


#29

LOL nice that i find one like me


#30

It has to play a role! it should differ if l=2 or =3 it makes a different what u mean by
don’t necessarily have to play a part here :thinking:


#31

Sorry for the confusion. I agree that it plays a part, but I meant that the end result is determining how many areas have 0 light, so theoretically if you create a process just indicating where light exists vs where it doesn’t I think you can still put out a similar solution.


#32

Hey, I’m having the same problem with the validator not accepting challenges 5 and 6 (In the IDE all challenges are fully completed).
Can I show one of you guys my Python code? Thx <3


#33

Could you please explain the same in detail. Thanks!!


#34

maybe i get it when i find the solution :smiley: thx


#35

Nice easy puzzle. As written in a previous message - keeping it simple here is the best approach, and indeed no need to consider light intensity (although it was nice as part of the D&D description…)

Thinking about the original premise a bit more - I can see here the potential for a bit harder puzzle, that will ask you to find a path between two points in the room where you get the least accumulated light


#36

this makes no sense to me, how am i supposed to know where the candles are?


#37

It is explained in the statement :
You will receive a map of the room, with the empty places (X) and Candles (C) in N rows, each character separated by a space.


#39

Hello, I think I have problem on large map with high light…
Here is my result matrix in a test :
[1, 1, 2, 3, 3, 3, 3, 3, 2, 1, 1, 0, 0, 0, 0]
[1, 2, 3, 4, 4, 4, 4, 4, 3, 2, 1, 0, 0, 0, 0]
[1, 2, 3, 4, 5, 5, 5, 4, 3, 2, 1, 0, 0, 0, 0]
[1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1, 0, 0, 0, 0]
[1, 2, 3, 4, 5, 5, 5, 4, 3, 2, 1, 0, 0, 0, 0]
[1, 2, 3, 4, 4, 4, 4, 4, 3, 2, 1, 0, 0, 0, 0]
[1, 1, 2, 3, 3, 3, 3, 3, 2, 1, 1, 0, 0, 0, 0]
[0, 1, 1, 2, 2, 2, 2, 2, 1, 1, 0, 0, 0, 0, 0]
[0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

Did the 1 circle is correct or not ?

thanks


#40

not it is not … you’re wrong for 3,2,1

should be
[1,2,3,3,3,3,3,3,3,2,1,0,0,0,0]

=> “square shape”


#41

Thank you for this post! I had the exact same issue. Thanks to you I found the issue and fixed it :slight_smile:


#42

I think the riddles just count only with radius and not count with brightness (lumen). If two or more candles are in the radius of each other, the lighted area must be larger than sum of area of each candle one by one.
For example there is a candle in 2,3 position with L=3
0 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0
1 2 2 2 1 0 0 0
1 2 3 2 1 0 0 0
1 2 2 2 1 0 0 0
1 1 1 1 1 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0

When the second candle is put on 5,3
The shape of the lighted area must be greater. Can not be value 0 next ot value 2, nor value 1 next to value 3 etc. :
0 1 1 1 1 1 1 0
1 1 2 2 2 2 1 1
1 2 2 3 3 2 2 1
1 2 3 3 3 3 2 1
1 2 2 3 3 2 2 1
1 1 2 2 2 2 1 1
0 1 1 1 1 1 1 0
0 0 0 0 0 0 0 0

So in these situations there must be some fields that brighter than 0 and still being farther than they sould be from the candle. The more candles are, the more brightness and area we get.

For example the result of the 3rd test case can not be 2.
X X X X X
X C X X X
X X X X X
X X X C X
X X X X X

The result is 2 if the brightness does not cumulate:
2 2 2 1 0
2 4 3 2 1
2 3 4 3 2
1 2 3 4 2
0 1 2 2 2

The result should be 0 like this:
3 3 3 2 2
3 4 3 3 2
3 3 4 3 3
2 3 3 4 3
2 2 3 3 3