Power Of Thor - Episode 1 - Puzzle discussion

There’s a typo in the instructions for Power of Thor - Episode 1

Output for a game round
A single line providing the move to be made: N NE E SE S SW W ou NW

ou should be replaced with or

Has a platform bug.

I had a variable called $vertical with value 0 and was entering in a if($vertical==“cima”)

Of course 0 is not equal to “cima” …

In TEST CASE LIST the name of the second test shows as “Up” and pass. (100%)

After SUBMIT the second test shows as “Down” and fail, giving only 75% of score.

I only score for 75% because the last optimal angel, thor cant reach it before its energy use finish, can anyone help?

You are probably only outputting N, S, E, W. You need to utilize NE, NW, SE, SW. This way you can get to the goal in fewer moves.

  • danBhentschel

Am I the only one that actually went in a straight line? lol I feel stupid for doing that when no one else did :frowning:

get to 75%… I and some code to check the boarder of the game. But it does not listen.

maxy=17
miny=0
maxx=39
miny=0

So i check thorpos and going direction an ad or decrease thorpos an i compare it does not fall of the grid.

paste it into a if (thorposx < Lightx) && (thorposx > minX) && (thorposx < maxX && also for the Y param every time its true i’ll ad a +1 or -1 regards on movement.

But it does nothing whit the maxX and maxY.

This can be solved without using any conditions at all! For anyone who’d like an extra challenge.

perhaps someone already has said (do not know, there are too many different/diverse issues), but also found a more than a “bug” fails: I don’t load test # 3 because it is this:

“Standard Output Stream:
WS
Game information:
Expected to movement (one of N, NE, E, SE, S, SW, W, NW) but found 'WS '”

Why not expect to find a movement called “WS” but receives the code? I already checked and compared with the pseudo-code and itself is fine. Until I compared it with the solution and comes out the same.
This is mine:
var directionX = ""; var directionY = ""; if (thorX > lightX){ directionX = "W"; thorX--; } else if (thorX < lightX){ directionX = "E"; thorX++; } if (thorY > lightY){ directionY = "N"; thorY--; } else if (thorY < lightY){ directionY = "S"; thorY++; }

So how to solve it, i try many ways but still cant work, gt any clue?

I’m doing it in C and my code fits the solution perfectly (or so I think), but it’s not completing. I keep getting the error “Timeout: your program did not provide an input in due time. Earth was destroyed!”. Any help? Where should I look in my code?

infinite loop most probably or absence of output in one iteration of the while loop

Hi,
On the third validator he don’t want to “success” however Thor go to the light :confused:
Maybe a bug I think

hey guys

i am quite stucked in the 3d challenge

[No full code please]

i have this piece of code, my problem is tha in the 3d challenge lightY is not equal with initialTY, but yet when i run it it still chooses W, which is not possible since lightY is different from initialTY
is there something i missed??

Do you update Thor’s coordinates?

Hallo, bei “Power of Thor” soll ich(i) in 15 Zugen bei meinem Ziel(Z) sein, Problem ist die Korinaten sind Z(0|17) und i(31|2) … wenn ich quer nach unten gehe schaffe ich es nie in 15 Zügen Oo

Ich nehme an, es geht um den Testfall “Easy angle”?
Zu Beginn bist du bei (31/4) und hast 44 Runden Zeit. Schaust du vielleicht nach einigen fehlerhaften Zügen, wo du jetzt bist?
Und das hier ist ein englischsprachiges Forum, also schreibe bitte in Zukunft englisch.

translation:

Hello, at “Power of Thor” I have to reach my target within 15 turns. The problem is, that the target is at (0/17) and I am at (31/2). When I go down diagonally, I can never make it within 15 turns.

I assume, you are talking about the testcase “Easy angle”?
Initially you are at (31/4) and have 44 turns to reach the target. Do you look where you are after a few faulty moves?
As this is an English forum, please post in English next time.

edited: solved thanks :slight_smile:

It is because you only output one direction at a time although you could output two directions at a time, so you spend two rounds (outputting ‘S’ then ‘W’) to go on a direction such as “SW” that takes only one round.
The game take your input and count a round as soon as you output ‘endl’.

Please don’t let your code in your post.

CodinGame, update your parser!

I was using PHP to solve this, and had the math for direction calculation run through two Switch statements (one each for X and Y of Light). My code passed test cases 1, 2, and 4. On 3, Thor would always go East instead of West.

I double and triple-checked my code, read through this entire forum, then checked my code again.

For the heck of it, I changed my elegant switch statements over to a group of ugly IF statements, and voila! It passed all test cases and I even got a 100% score after submitting.

So to reiterate, please update your PHP parsers, because I had to DUMB DOWN MY CODE to pass this test.