Shadows of the Knight - Episode 2 - Puzzle discussion

Sorry i didn’t save the replay when the issue occured and changed my approach to avoid those cases, the algo changed a lot since and I can’t reproduce it myself (by jumping straight to the two posistion from the start).

Dear colleagues,

I dont want to read whole discussion because i want to find solution myself, so if my question is duplicite I am sorry about that.

I met one thing which wonder me.

In rules part is written:

  • UNKNOWN The device cannot provide you with any information: only happens before the first jump

But I get value “UNKOWN” after the third iteration in: “A lot of jumps” and I wonder why.

Did I understand everything correctly?

It looks like you’re outputting something before you read bomb_dir for the first time; it’s technically still the first turn at that point.

By the way, please avoid posting codes on the forum.

Best ever puzzle so far,

But I think tests should have a little bit more steps. as even if we apply “binary” search, it has not enough moves, which I think is not right

as I pass all tests except 6. and I need only 1 more move to pass test. I guess it is due to discrepancy between “int” and “float” values when we need to round up the values

Finally, I have done it, using Binary search. I feel somehow it has very little moves so even “Binary Search” has issues with number of moves

In TestCase02:
Bomb is at position (2,1)
“Batman moved from window (1,1) to window (2,2)
Batman is as close to the bombs”
How come position (2,2) is closer to the bomb than (1,2)?
Even worse, next step is “Batman moved from window (2,2) to window (2,2)
Batman is as close to the bombs”
How come (2,2) is closer than (2,2)?

Thanks

Would you please share the link to the replay of that case? You can use the button next to the gear in the viewer to get the link.

Thank you for interest.
Here is the link Coding Games and Programming Challenges to Code Better
Hope it does work.
I do know that I need to fix the code too, it’s not working as I expect, but nevertheless I doubt that jumping from (2,2) to (2,2) should give CLOSER.

The replay link works, but I don’t see what you described. I see this instead:

It says “as close to”.

Just to confirm, are you also talking about the 8th frame? Does the console show you something else? If so, would you please copy and paste all the messages (including your output) before that turn, during that turn and after that turn here?

You are right, and I am sorry that I made confusion.
Somehow, I expected ‘same distance’ instead of ‘as close’ so I didn’t pay enough attention to differentiate between ‘as close’ and ‘closer’.
Thanks for clarification, and sorry once again.

1 Like

I had the same problem. The reason is the special case where the bomb is close to the edge of the board. Image it is in position 0. When you are in position 0 and then jump to the mirror, then you still cut the area in half. However, when you jump back you cannot jump back more that position 0 so you will not reduce the area anything at all. One solution is to make sure you only jump to the middle of the area when you are on the edge. When the bomb is closer to the edge, you cut to 1/4 of the area in that jump, but nothing when jumping back so effectively just as much as the regular case when you cut in half for each jump as long as the bomb is closer to the edge than the middle of the interval. ONce the bomb is not closer, you only cut 1/4 of the interval but then you will be able to cut 1/2 for each jump after. Makes sense?

Hello,

I’m under the impression that the last validator 08 moves the bomb according to the run either to (0,2) or (0,3), so that I can never reach it. Why is that? The validators should be fixed. I can never reach the bomb even if I hardcode it :open_mouth:

You can reach it without hardcoding it, with a better search probably. Study the replay and see where you can improve.

Thank you. The harcoding part was just to illustrate my point: I didn’t hardcode it, in fact I’m just 1 step from reaching it, landing right next to it. I just found it frustrating that the bomb “moves” between runs hehe.