Hey there… could anybody provide me some clue about how to shorten my code in Power of Thor - Code size even more?
I’m currently on 123 chars in PHP and I’m pretty much done… there is nothing i can do with the code to shorten it anymore. But there are many people in the leaderboards above me with a shorter code. I don’t really get it
[EDIT: NO FULL CODE]
The code is already significantly corupted, but it’s still working…
…any tips what should i do differently? …cause there’s gotta be a major thing that I’m missing.
Not sure you should post complete code on a publicly accessible forum.
To answer your question, you may want to try another language (Ruby is often better for golfing). Also, I suspect that virtually all top solutions use hardcoding (i.e. not actually solving the general problem, but just the validation tests).
Well, there are people who solved it with lest then 70 chars in PHP, so it’s not about language (or at least not at this moment for me)
Btw, I’m practicaly hardcoding as well… i removed an if which makes Thor to go north (just because he’s not heading that direction in any of validation tests) …
You must embrace the hardcoding. Read only what you need, read only one character is you want, that’s enougth.
For me ,it was very helpful to find another coder, who was shortening his code,
so we battled us until one of us had no further idea, how he could shrink his code,
then we compared our codes and everyone could find some passages in the other one’s code, where he could reduce some signs.
If you work this way and do not let you give a final solution, then you learn more about your language and general code design patterns and you become creative in finding unusual strategies to solve problems.
I did it with 103 and i’m still too far from the the current top (62), I’ll be glad to share some thoughts, if you are still into it