Code of the Rings - Optimization - Puzzle discussion

I’m currently 712th using a very simple approach: look for the closest rune (in terms of ‘<’ and ‘>’) whose letter would require the minimun steps to reach the desired letter.

I’ve only used loops to reset runes and move from ‘blank’ if it’s “cheaper” than moving from an existing letter.

Doing this, I can just look at a single input character at the time.

I understand that I won’t be able to reach the top spots just but doing this, but I’m curious if anyone used a similar strategy and did better than 712th.

Anyone?

Sometimes, it faster to use a reset loop, did you take that into account already?

Yes, if the distance from ‘blank’ is less than the distance from the other existing letters.

For example: I print ‘F’ with “[+]+++++.” but if there’s if there’s a ‘G’ two runes away I use “>>-.”.

Did you have other loop usage in mind?

I believe I can improve looking more input characters ahead but I wanted to be sure I got as far as I could with this simple approach.

I’m also considering optimizing the output (which seems promising) but I need to find a simple solution for not destroying the state.

1 Like

Yeah, I was talking about the [+] loop. :confused:

Next tip: Try several board initialisation and output the better one. E.G. Initializing the whole board to M, may be a good idea in some cases.

1 Like

Yep. I will need to find a criteria to determine that the cost of “non zero” initialization will be offset by the savings of having some letter “already on the board”. Probably the frequency of each character plays a role here.

Hi there
I ve got some questions about this very interesting puzzle :

  • the same code can produce different results and it seems to be because of execution performance that are not always the same : is there a way to handle this ?
  • because of this, I have sometimes submitted the same code several times :blush:, and it seems i reached the submition limit (100) :cry:. Is there a way to submit again ? because I still have some improvement to check :slight_smile:
    thanks for any answer

finally I just had to be patient et I can submit again :smiley:

I get very often an error when i try to run my code and i don’t know why, it seems to happen randomly ><

"Sortie d’erreur :

/tmp/Answer: No such file or directory.
No executable file specified.
Use the “file” or “exec-file” command."

Anyone knows where it could come from?

same as Narmand - I’m getting random execution errors on the tests, it is as if something was broken “server side”, can someone from codingame check what is going on here ? this is also occurring with my old code submission that used to work perfectly …

I tried again today with the same code, and it worked perfectly, it seems the problem has been dealt with, thanks! :slight_smile:

Which language? @Crog @Narmand

Did it happen on other puzzles?

In C++, and i never got this problem on any other puzzle so far.

It was in C++ as well. I did not see the same issue on any other puzzle.
The day that I posted the message above, I also mentionned the issue in the french real time chat channel. Some people there told they were experiencing the same issue on other puzzles. Somebody from CG then said he was making changes in the infrastructure that were probably at the origin of the issue. A few minutes later he asked me to check if the issue was still occurring on my side : it was not !
Sorry, I don’t remember who he was.

1 Like

Is there a simple way to initialize all runes with a letter ?
And is someone used at least two nested loops and for which case ?

Thanks

a simple [>+] will for example initialize all runes (except one) to Z. [>-] will initialize all runes to A. You can tweak this examples to initialize with other letters.

1 Like

Hi,

I just achieved the most basic implementation. Insted of going in exploratory mode, I would like to know if there are some general theory/algorithm that could be applied to this puzzle so I can read stuff about it.

Cheers,

Thibault

Yes, it’s just the BrainFuck language repackaged.

1 Like

Oh nice, I didn’t noticed that, thanks :wink:

do you think it is possible to optimize blocks of 26 characters by positioning the correct letters and making a loop [>.] after that? in certain cases?

Exact, ceci dit pas encore bien réussi à décrypter les règles du jeu… Quel est le résultat attendu des runes pour le 2ème jeu de test? :smiley: