I think the problem is, that you set the distantion_x<0 and distantion_y<0. The distantion can’t become smaller than 0.
How do I send my code or attempted solution for help?
The tests aren’t coded well
I can change something from ++ to + 1 and get completely different results
Take note that in most languages the order of operations and their precedence is different between the ++ operator and the + operator. This might explain the difference in behaviour you’re experiencing.
Also consider that ++ changes the value of the associated variable, while +1 does not . The result of the latter is a separate (temporary) variable which you might want to reassign back to the original variable.
I can’t seem to get 100%, in the 3rd test case after submitting, in the video preview, thor just continues straight over the light?
Can you share the link of the replay of that case?
Do you know how I might be able to do that? I couldn’t find any way of sharing my solution let alone the video from the 3rd test case after submission
Please don’t share the code on the forum if possible.
The replay link may be found in the viewer, please refer to the below screenshot for your reference (“REPLAY AND SHARE” button):
please tell me i’m not the onl one who could not solve it guys i’m dump af
If you haven’t learned any programming languages before, it can be difficult, as you’re expected to have some knowledge in at least one of them in order to solve the puzzles on this website. Otherwise, you may get some hints by clicking the HINTS button to the left of the puzzle statement.
Hi,
From what I see tests Easy Angle and Optimal Angle are swapped between IDE and submission. In IDE I have all tests passed, but for some reason in submission Easy Angle (which is Optimal Angle in IDE) is not passing. No clue why.
Have a great day
Did you watch the replay for the failed case? If not, you may check it out to get an idea of what may have gone wrong. If you still have no clue, you may share the replay link here for us to take a look (see my post here 7 days ago for how to get the replay link).
Yes, I’ve watched the reply and can’t see what’s wrong.
this escaped the mods
same
i have the same problem
O O F
I have a gripe with this puzzle. It’s actually more efficient to move diagonally towards the target as often as possible since we’re working in euclidean space. But because of the ‘bounds’ ensuring you don’t go off the path, you’re required to be inefficient after the third test case.
Continuing the discussion from Power Of Thor - Episode 1 - Puzzle discussion:
I have an issue with the amount of time to answer taken to resolve my program. Indeed, I get the error “Timeout: your program did not provide an input in due time. Earth was destroyed!” Unfortunately,I don’t see the issue in my code. Can somebody tell me what’s wrong please in my following code ?
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
/**
- Solve this puzzle by writing the shortest code.
- Whitespaces (spaces, new lines, tabs…) are counted in the total amount of chars.
- These comments should be burnt after reading!
**/
int main()
{
// the X position of the light of power
int LX;
// the Y position of the light of power
int LY;
// Thor’s starting X position
int TX;
// Thor’s starting Y position
int TY;
scanf(“%d%d%d%d”, &LX, &LY, &TX, &TY);
char directionX;
char directionY;
int k;
// game loop
while (1) {
// The level of Thor's remaining energy, representing the number of moves he can still make.
int remaining_turns;
scanf("%d", &remaining_turns);
// Write an action using printf(). DON'T FORGET THE TRAILING \n
// To debug: fprintf(stderr, "Debug messages...\n");
char move;
if ((TY>LY)&&(TY>=0)){
TY-=1;
move+='N';
}
else if((TY<LY)&&(TY<=18)){
TY+=1;
move+='S';
}
if ((TX>LX)){
TX-=1;
move+='W';
}
else if((TX<LX)&&(TX<=40)){
TX+=1;
move+='E';
}
// A single line providing the move to be made: N NE E SE S SW W or NW
printf("%c",move);
}
return 0;
}
You have to output a newline character after the direction. Also, I’m not sure whether your code is able to output a “compound” direction such as SE.
By the way, you may format your code properly on the forum by using the </> button on the toolbar.
I thought I had the same problem but then realized that the Y coordination is reversed, it starts from HIGH to BOTTOM