Power of Thor - Codesize - Puzzle discussion

When the CEO gives you a hack :slight_smile:

4 Likes

Hey!
Do you know a better way to shorten your code than by using lambda functions? I have more than the double caracteres than the first one in python 3, and I do not see any other way to improve what I have (exepted the solution which consist to find a better algo, but I do not have not found it yet).

To a better understanding of my issue, my lambda function is currently necessary to me as I am doing something twice.
Thanks.

Then, I think another way of improvment is that we can shorten the initial line by doing something else than ā€œinput().slice()ā€ but I do not have any hint to do so yet.

2 Likes

Hi Yandross, in my solution I only read the input, do the while loop, do a print and increment a value. No need to use a lambda function nor to rename a function.

3 Likes

Thanks. Actually, I should review my algo. Without my lambda function, I only have one character less since I’m doing identical things twice. I do not see how you can increment only one value thougth. There are two axes, and I do not know how to update data about these two axes easily.
Anyhow, I will pass to something else for now.

1 Like

I’ve exploited the fact that the tests are incomplete to increment only one value: unless LX == TX initially, you always need to move horizontally.

4 Likes

Ok, I though it would be something like that to reach the top. I’ll let my solution as it is so, thanks.

2 Likes

I fully agree. I don’t see the point. I use C++ and I prefer to focus on the clarity of the code rather than on its length. Even for javascript users I believe some automated tools exist to reduce/compress the source code as much as possible. Really, I don’t see the point even if I understand the challenge when we try to optimize gas in the Mars Lander challenge.

At the end using single letter variables remind me programming my calculator… It was a long long time ago in a galaxy far far away… :slight_smile:

Best regards, Philippe

2 Likes

I have the same problem. Does the report show the results of the current submission or of the previous best? If it’s the previous best I cannot track errors. If it’s the current submission my code has passed all the test yey my score hasn’t been updated.

1 Like

Atm, it’s the best one.

1 Like

So is there any way to check which test case failed? My code passes all the pre-submission tests

1 Like

The validators and the test-cases are the same.
We will add a char counter ASAP

2 Likes

I think it’s a very good puzzle! It may not be useful on real life to write code this compact, but the exercise of exploring the syntax is perfect for learning a new language and thinking different algorithms combined with syntax changes is very challenging! That’s why there aren’t many people with the same score, because this is a great exercise! :wink:

2 Likes

The char counter does not count the same number than the report. @SaiksyApo

1 Like

@nicolas_patrois I bet you’re working on Windows. :stuck_out_tongue:

1 Like

No, Debian. Debian GNU/Windows does not exist. :wink:

1 Like

Ok, so it’s a different bug, because I tried Windows and Ubuntu and it worked as expected :frowning:

Can you explain what happenned ?

1 Like

Maybe tabulations are counted as one or as four?
I’ll try it again later.

1 Like

A tab count or should be count as 4.

1 Like

My code has 446 chars in the editor and 713 in the validator. Moreover, I replaced all tabulations by spaces. 8-|


1 Like

why the source code size? why not the execution speed, or compiled code size, or byte-code size?

1 Like