Power of Thor - Codesize - Puzzle discussion

This is a very good point, it’s a massive pain in the neck especially in clashes, as you have to go through removing whitespace, and periodically check that you haven’t accidentally deleted some important code, and if you decide you want to edit it then good luck!

Is there any way to post comments to the devs to suggest this?

ha, I feel the same way! I was very happy with my code size of 171 until I noticed someone did it with 63… Have you figured what the method is they used?

Lots of people talk about using the “system” function. Without further details on this, for me, it looks like remote code execution of some kind or evaluating (shorter than python) bash code? Cool that they have ~60 char codes… But it’s totally misses the point.

sooo it’s more of hacking than solving the puzzle? Thanks for the explanation, now I’m happy again with my 171 :slight_smile:

Feel free and ask for Help?? Well this is my cry for help; Can you please tell me where I am going wrong with the code?

// game loop
$thorX = $TX;
$thorY = $TY;

$directionX = “”;
$directionY = “”;

if ($thorX > $LX) {
$directionX = “W”;
$thorX–;
} elseif ($thorX < $LX){
$directionX = “E”;
$thorX++;
} else {
$directionX = “”;
}

if ($thorY > $LY) {
$directionY = “N”;
$thorY–;
} elseif ($thorY < $LY){
$directionY = “S”;
$thorY++;
} else {
$directionY = “”;
}

you’re updating thorX and thorY to their initial values at every iteration?

Damn … I’m stuck at 106 Char in Python3 …
I think for future improvements I’ll have to review my algorithm.
So far I map the input as int to 4 variables, then in a loop check the coordinates one by one to generate a string and print it.

Any hint on how to get shorter ? A bunch a people are around 80-90, so I guess it must be doable. (I’ve already ignored North since its not tested)

Any tips please…
My code size is 61 in JS, and i have no idea how to reduce it… :frowning: but i find results as good as 58 ! How!?
Is it possible to use something shorter than “readline” or “print”?

1 Like

Sounds like you’re 4th in JS, you should really be helping everybody else here : )

1 Like

Hi all, I did it with 103 chars using PHP (and PHP is a bad language to codegolf) but then I saw someone that did it with 62…It’s a big diference so… I guess I’ll need a tip on how to get the input the shortest way possible with PHP.

Run another language inside PHP. :unamused:

Really !? I still want to believe that’s not happening…

Hello Approxit! I hope to stir your curiocity. Seems that 96 is possible with Python3 without using “system”. Or “hardcoding”, whatever it is. Use of “while 1:statement1;statement2;…” construct will help :slight_smile:

I personally did 88 in Python3 without “system” or “harcoding”.
I actually don’t see how you hardcode the solution ^^

Don’t parse input

you need to parse at minimum one input to hardcode otherwise how do you know the test number solution you have to provide?

OK, I did it in 98 chars in javascript by cheating and hard coding the output:

<mod note: don't post full code>

and 182 chars without cheating (no hard coding):

<and again>

But how do some ppl get this under 50 characters? Any tips? O_o

Of course:

system("code in bash")

Because i love to destroy dreams.

That’s not entirely right. The system trick does not work with Javascript (system is deactivated on the platform).

With other languages, it may be true for Temperatures, but definitely not for Power of Thor.

I believe the “anti system hack” is only active on Temperatures. You can do it on Power of thor.