Power Of Thor - Episode 1 - Puzzle discussion

The issue seems to be related to the indentation in your code as per our private messages.

If you still have any question, please feel free to ask :slight_smile:

I cannot understand, why it doesn’t read code each turn:

I have code like:

elif light_y == initial_ty:

but when Thor in 3rd test cases came to this point:
Thor position = (18,17). Light position = (0,17). Energy = 31

it ignore my: elif light_y == initial_ty rule and go to next in code, but that was previously executed. Looks like he stuck on one string and do it

Your code executes exactly the way you code it. Walk through your code, see how the variables are changed during execution, so that you can find out where things may have gone wrong.

can’t get it :frowning:

Did you try to add debug code?
print(variable_name, file=sys.stderr, flush=True)

1 Like

found the problem, starting values doesn’t changed each round :slight_smile: I’m comparing all the time with one value))

2 Likes

Hi, my code works (C#) but my conditions are not well expressed , it means an else false at the end.
For the moment my principal conditions are

if (lightX==initialTX)
else if ( lightY == initialTY)

else if (lightX > initialTX )

else if((lightX < initialTX ))

Thanks a lot for you help to make my code better

what is the code for the first input and first round, please?

You may ask for hints, not solution codes, on this forum.

Hi I tried the code with feedback but I still cannot run the third and fourth test case. What should be the problem?

Read the console log which include the error messages to see what the problem is.

Same but Im doing the puzzle on java script

here can i use fct append ?

What’s that?

In the Episode 1, you can’t use variable to set the area in which thor can evolve and move, this lead to bug like if condition not being properly verified as false, and thor getting out of bound when he shouldn’t.

Not sure what you mean, but you can always create variables as you see fit in your code, to avoid bugs and to prevent Thor from wrong moves.

Can anyone help me solve the code of test case 3 and 4 please?

You may click HINTS on the left hand side of the website to find some hints which may help you. Remember your code has to cater to all the test cases and validators in general. If you still have a problem, you may ask here but please be specific what the problem is and what you have tried to solve it.

I don’t get it, why should Thor go North(Ty-1) when Thor is above the light, and the light is below him, (Ty > Ly) … should not he be moving South (Ty+1) ?

Please note the Rules in the puzzle statement:

Note that the coordinates (X and Y) start at the top left! This means the most top left cell has the coordinates “X=0,Y=0” and the most bottom right one has the coordinates “X=39,Y=17”.