Temperature Code Golf puzzle discussion

You can see others solutions only if you have solved the puzzle, and only for the language(s) you have used.
Why spaces should not be counted ? If you can write an instruction without spaces do it.

You can see others solutions only if you have solved the puzzle, and only for the language(s) you have used.

Sure, but you can solve it somehow (overcomplicated or just not short) in practice and then just copy the best solution found from another person to the competition.

Why spaces should not be counted ? If you can write an instruction without spaces do it.

That’s exactly why it should not be counted. If the instruction works either way, the formatting should not affect code length. Every editor tells you to write nice code and then we shall forget everything, even if it does not make a difference.

Code golf is all about making the shortest code, not the most beautiful, neither the most performant. And spaces are just details, the big work is on finding language tricks and “alternative solutions”. Furthermore the shortest solutions are generally not the simplest ones, so the solutions of the practice section are not a big deal here…

1 Like

In some languages, there are tricks to save characters by properly adjusting spaces.
For example if you want to write in Python:
[1+n*n for n in range(10)]
You can save a space like this:
[n*n+1for n in range(10)]
So they should be counted.

2 Likes

Is 29 char solution hardcoded ?

I doubt it, validators are known but it would take a lot of chars to hardcode it, it’s not worth it.

I wonder if these very low scores are still rechable tho, cause I see a lot of short solutions that are not valid anymore in the puzzle section.

So maybe validators changed at some point and it was easier before, I don’t know.

This one is very mysterious to me, as is the C score for Chuck Norris.

3 Likes

Orabig macros ?

Hi golfers !
With the recent update of the languages, it could be interesting to recompute scores. Some solutions could be now unreachable (ex: kotlin with minBy).
Also as suggested by OptiPanda some test cases are missing and wrong solutions can pass all validators with less characters.
I know that some of you like to bypass validators but I think not everyone does (ok at least me!). That’s why I like temperature over the others.
But there are still some cases not covered and at least one of my solution is not correct.

Here are the cases that I have noticed that can allow me to gain characters :

1
5526

2
1 0 (order is important)

3
4 0 -8 (0 in the middle and 0 < |4| < |-8| is important)

and a suggestion, the ranking in case of a tie is obviously based on timestamp, it could be interesting like in multi to have this time as a tooltip.

Haaa. This is the sad answer to what I had been wondering for a while now.

I was able to finish in seventh position in pure Javascript (60 characters), and was seeking knowledge about these mysteriously low top six submissions…

Little bit sad, but I guess it’s part of the game… :pensive:

In fact, this answer is deprecated (5 years old, ouch …). Since now CodinGame uses NodeJS and not SpiderMonkey anymore.

And calling a bash command in NodeJS will require too many characters. Javascript solutions in golf puzzles are now (as far as I know) pure javascript solutions.

But, this answer is still valid for many other languages such as python, ruby, C++, C, perl …

Are the golf leaderboards ever recalculated? The last update broke calls to ruby (now you have to use the full path /usr/local/bin/ruby), but this only impacts new solutions.

Thanks for the info @Magus. This restores my faith in javascript golfing!

In the last 30 minutes I indeed learned and tested a way to run a Bash script in JS and ended up with a minimum of 49 characters to call an empty bash script. I suppose this proves the 31 char Bash solution isn’t worth calling from JS to get the top score on temperature.

golf puzzles are now (as far as I know) pure javascript solutions

Would anyone be able to confirm that for the JS enthousiast?

Yes, I think the step you are missing is compression to unicode. You can compress JS 2:1 with an overhead of 26 characters. So your 60 can go down to 26+60/2= 56 which would tie for the best.

1 Like

I can confirm that it’s pure JS (compressed).

I’m launching a recompute of code golf solutions, puzzle per puzzle. I think the last Dart update also impacted solutions. It will take some time

2 Likes

Wow, many codes will be broken :rofl:

Mostly because of the bash update.

1 Like

Thanks for the tip haha!

Oh nice trick, thx !

Hello !!!
Everything’s fine until I submit my solution.
Only validator 7 isn’t right and impossible to know why ?
How is it possible to understand where is the problem ?

Thank you

It’s in Java.