Try walking through your code manually to see why in Test 3 your code ended up outputting 38 37 and 38 39 alternately.
Also, in the future, please describe what your code does rather than posting your entire code here.
Try walking through your code manually to see why in Test 3 your code ended up outputting 38 37 and 38 39 alternately.
Also, in the future, please describe what your code does rather than posting your entire code here.
Spent like 45 minutes trying in Java just to get it to output the 2 integers as ints without adding them together. If you cast them as strings, then it gives and error that they need to be ints. If they are ints then they get added. I tried outputting an array of the 2 ints, but that didn’t work either. I switch to Python and it works in 3 seconds. Very annoying waste of time. The hardest part of the puzzle shouldn’t be formatting the output.
How do you do it, It doesn,t let me move.
It looks like most people just implemented a basic binary search algorithm which works fine unless the bomb moves outside of the original search range. The algorithm still finds the bomb this way because it increments the search range until it finds the bomb, but the algorithm becomes O(n) at that point instead of O(log2(n)). To maintain O(log2(n)) throughout all cases, the search window needs to be reset to the outer limit towards the bomb once the two ends of the window become equal.
i had the same problem then other, and (i use PYTHON) i change round() to int() and it works too
Hello!
I am struggling to solve test case 6. I have managed to best all the other test cases, but test case “evasive” seems to remain elusive to me. Anyone can help me understand what I might be missing? I’d post my code but according to a moderator edit we shouldn’t be posting code in comments, how should I share my code instead then?
Maybe you can try sharing the link to your replay of that case you’re struggling with first?
test 7, ‘not there?’ completes with 0 rounds left but never the less completes
You can turn on DEBUG MODE (check the gear button) to see better. The bomb is located at (0, 0) but Batman was able to reach (0, 1) only in the last round.
yeah, I know, my issue is I have no idea why it happens and what I might be doing wrong
Remember that you want to minimise the number of steps. So you divide the possible choices into two halves.
Look at the last few steps. After Batman moves to (0, 3), the worst scenario is that the bomb is at (0, 0), which is exactly what happens here.
Your first guess is (0, 2) and then (0, 1) and then you would have guessed (0, 0) but you have run out of turns already. So you need 3 turns in total to reach (0, 0). You have not divided the choices into two halves.
However, if your first guess is (0, 1), then you MUST be able to reach the bomb the next turn because it will be located at either (0, 0) or (0, 2). That means (0, 1) is a better guess than (0, 2). You need 2 turns only.
The same principle can also apply to your earlier turns, and in both X and Y directions.
okayyy, but how could one implement such better guessing?
Start by thinking about how you can output (0, 1) instead of (0, 2) when you arrive at (0, 3). How can you change your calculation to achieve that?
so I attempted to do it by Rounding the result of the calculations and now I instead go from (0,4) to (0,2) on the last one, replay: Coding Games and Programming Challenges to Code Better
It is more than just rounding the result. As mentioned, you really have to divide the choices into two similar halves. Take the y-coordiantes in your latest replay, for example.
Your y-coordinates change as follows:
98
→ 49 (0 to 48: 49 choices, 50 to 97: 48 choices)
→ 25 (0 to 24: 25 choices, 26 to 48: 23 choices)
→ 13 (0 to 12: 13 choices, 14 to 24: 11 choices)
→ 7 (0 to 6: 7 choices, 8 to 12: 5 choices)
→ 4 (0 to 3: 4 choices, 5 to 6: 2 choices)
→ 2 (0 to 1: 2 choices, 3: 1 choice)
→ 1
→ 0
You need 8 rounds to move to 0. Notice that you aren’t really dividing your choices into similar halves.
But if you actually choose the real midpoints like this:
98
→ 48 (0 to 47: 48 choices, 49 to 97: 49 choices)
→ 23 (0 to 22: 23 choices, 24 to 47: 24 choices)
→ 11 (0 to 10: 11 choices, 12 to 22: 11 choices)
→ 5 (0 to 4: 5 choices, 6 to 10: 5 choices)
→ 2 (0 to 1: 2 choices, 3 to 4: 2 choices)
→ 0
You need 6 rounds only, and that’s achieved by minimising the number of choices in the worst scenario by ensuring both halves of the choices are of similar sizes.
Think carefully about how you should calculate the midpoints.
Bisections are doing my head in!
Man medium is a lot rougher than easy haha o( ̄┰ ̄*)ゞ
[Mod edit: Please do not post codes on the forum.]
i can not pass 07 not there,is something error in codes?
The console told you what was wrong:
Failure: you are too late. Joker's bombs exploded. The hostages are dead. You lose :(
In the viewer, you can click the gear at the bottom right corner to turn on DEBUG MODE and ADAPTATIVE MODE. This will allow you to see clearly where the bomb is. You need a better strategy to reach that bomb earlier.
You will look for the hostages on a given building by jumping from one window to another using your grapnel gun. Your goal is to jump to the window where the hostages are located in order to disarm the bombs. Unfortunately, you have a limited number of jumps before the bombs go off… can somebody help me to solve this ?
Can you be more specific about how people should help you? Are there specific cases that you’ve failed? Or any aspects of the puzzle that you don’t understand? What approaches have you tried so far?
If the entire puzzle is too difficult for you, you may want to attempt some easier puzzles first.