Power Of Thor - Episode 1 - Puzzle discussion

kan you help me please

speack you german

No, English (and French).

du hast mich gefragt un ich hab nicht gesagt
nein, wir sprachen deutsch nicht

Hi,

my code seems to always result in the same movement, even when I intentionally screw it up buy decrementing it by 1 when I should actually be incrementing as Thor’s position is less than the light position. Does anyone know what might cause this? Oh and another thing I tried was adding these two conditions:

    if thorX is not light_x:
    if thorY is not light_y:

And nest the conditions in there, yet it didn’t change anything even though Thor’s initial Y position is 4, which matches the light position for the first test.

EDIT: I wasn’t aware that we needed to delete the print statement that was part of the auto generated code. This should be made clearer as one would think that it was placed there to serve some sort of purpose and would likely leave it.

    int x = lightX - initialTX;
    int y = lightY - initialTY;
    while (true)
    {
        string s = "";            
        if (y < 0) {
            s += "N";
            y++;
        };                    
    /*skipped*/                    
        Console.WriteLine(s);
    }

i have the same issue here with javascript inside loops variables newer updates just keeps going

Once ragnarog starts to move impossible to update variables he is just keeping moving towards same direction

Maybe you have to update Thor’s position.

i do update with if else statement i have a block like if thorx is greater than lightx x-- inside the loop which doesnt make any sense when i printErr i see it just keeps behaving the same

This puzzle is missing one test scenario. Missing test scenario should utilize configuration where Math.Abs(initialTX - lightX) < Math.Abs(initialTY - lightX). So that if you make a rectangle out of Thor’s and Light’s coordinates, you get a rectangle with shortest side sitting on X axis! For now, both tests with angles does opposite thing Math.Abs(initialTX - lightX) > Math.Abs(initialTY - lightX).

the output error is that:
Expected a movement (one of N, NE, E, SE, S, SW, W, NW) but found ‘E’
Thor position = (5,4). Light position = (31,4). Energy = 100

what I should do?

Which language are you using?

i’m using C language

Maybe your string has quotes in it.

the code is that:

EDIT: NO FULL CODE
You may share one part of your code, but not the entirety of its logic -> let others think about how to solve this puzzle :slight_smile:

directionX and directionY may be uninitialized (when initialTX==lightX or initialTY==lightY), leading to random characters being printed.

how to do it??

@DanFletcher i have your same problem, what do u did to solve it?
printf("%c%c\n",directionY, directionX);

if your directionY is zero, than your string gets zero-terminated at first char and directionX is never printed
i assume zero-termination as it is printf from C