Power of Thor - Codesize - Puzzle discussion

81 chars is impressive, it must be clever idea behind transforming points to directions, 33% more clever than my current approach. Or maybe there is something I don’t know about obtaining input. I found this great code-golf stack thread with tips on golfing in python but can’t see anything I would not know already, so definitely it must be clever idea.

Any hint on this? It does not seem possible.

The best i could obtain with fully deterministic python is 94 chars and that is using a lot of golf tricks already…

Thanks to you I looked at it again and found a 80 chars solution.
I don’t know what you did already so it’s hard to help but you want to abuse the fact that booleans can be interpreted as integers.
for example you can do this kind of stuff:
a=(b<c)-(d<e)
normally the brackets are mandatory but you can save one char with this kind of trick:
a=b<c;a-=d<e

80 chars?! That’s incredible…

Yes, i’m already doing a similar trick with booleans. However, instead of that, you can also do:
a=b<c-(d<e)
and it will work out the same.

Maybe the way I choose output and loop is inefficient?

Without spoiling too much, I’m using an infinite while and selecting from positions in a string.

There’s a precedence of - over < so if you do this:
a=b<c-(d<e)
it means:
a=b<(c-(d<e))
which is probably not what you want.

Thank you! This actually revealed that my code wasn’t working as I thought it was and was still passing.

Down to 88 chars now, but still not fully deterministic.

Hum… In what unit are we talking ? IndicisionTree’s last submission is 69 which seems correspond to 88 in his post (coincidence ?). If both of you are talking in bytes then I must be the one who missed something.

Anyway, nice tip, I’ll take this one. Could save a few bytes.
However, I have no idea how you got so low. This is the only language where I didn’t manage to reach your score and by far. Like your mysterious temperature one… Impressive :wink:

We’re talking about the number of chars of a fully deterministic code that would pass any set of validators.

Our actual scores are lower cause they’re based on the current validators.

Just to clarify, Chinese characters trick is still a fair play for “fully deterministic code that would pass any set of validators”?

Yes sure, why would that not be fair play?
abusing exec has always been valid, typical example in python:
exec("f();"*n)
instead of:
for _ in' '*n:f()
Also if a sequence of symbols appears a lot in a long script it’s common practice to use a exec+sub combo.
So it means that the script itself can be worked on as a string.
Any kind of compression of the script is legitimate IMO.

I got down to 72, tho not seeing much room anymore. You have some tips ?

Well, when I got from 140 to 68 it was just the beginning. It’s hard to imagine you got 72 with different approach. So I can’t suggest anything without spoiling all the fun, sorry.

not quite sure if we’ve goth the same approach. I have three different approaches.
72 with loop
76 with loop alternating SW - W
90 with Array

Nothing specific but pelmonks is a great source of inspiration
https://www.perlmonks.org/?node_id=1184255

Hello, i got 107 characters in JS, and seriously i don’t know how the first get 55 chars…
I read the discuss but this doesn’t help me ahah…
Semeone can get me a direction ? I want to know how to do it !

The first row i get it’s : [a,b,c,d]=readline().split' ' And i think we can’t do more …
but what about the rest ?? I make a for but this is the point i search, maybe i miss some maths ? Or we should play with boolean , but how ?

But the discussion suggests an evil trick : hardcode !
You can have an overview here

Please, as said by many users, add tests cases. Actually, you can hard code/random it easily and absolutely all top solutions arent legit. SO PLEASE, ADD TESTS CASES AND DELETE ANSWER THAT ARENT LEGIT.

1 Like

The claim that all top solutions aren’t legit is not correct. Some of them may be.

LOL.
You think 41 in bash is legit?
You think 42 in Perl/Ruby legit ?
Like… seriously… Did you read this ?

Do you really think top solutions are legit ? XD

Honestly; when you have really tried the problem you know very well that the best solutions are random and/or (depend on people) hard coded. It’s just denial to say otherwise.