Quinine

Discussion of challenges you have already solved
therethinker
Posts: 144
Joined: Fri Mar 28, 2008 11:29 pm
Location: #hacker.org on Freenode

Quinine

Post by therethinker »

That was really fun, actually. I think I beat you tails, I did it in 95 ;-) I really want to see how you did it. In so few instructions, I bet they're really similar.
User avatar
adum
Posts: 392
Joined: Thu Apr 19, 2007 12:49 pm
Contact:

Post by adum »

nice job! 95 is the new goal to beat =)
tails
Posts: 191
Joined: Tue Jun 10, 2008 7:51 pm
Location: Tokyo

Post by tails »

That's great! I never dreamed it could be any shorter. I'll try it too.

Adum, please give the credit for this challenge to therethinker if you agree.
User avatar
adum
Posts: 392
Joined: Thu Apr 19, 2007 12:49 pm
Contact:

Post by adum »

fair enough, whoever gets the smallest code gets the credit =)

by the way, your solutions are completely different, which i did not expect. some real creativity here!
tails
Posts: 191
Joined: Tue Jun 10, 2008 7:51 pm
Location: Tokyo

Post by tails »

That's interesting. I also did it in 95, but it is very similar to my previous code of 97.

I think I can show my code here, but I'm afraid it will be a great hint for the Very Small World challenge.
therethinker
Posts: 144
Joined: Fri Mar 28, 2008 11:29 pm
Location: #hacker.org on Freenode

Post by therethinker »

Thanks tails for the credit, once you hit 94 feel free to take it back ;-)

I'll try to do Very Small World, but in the meantime here's my code:

Code: Select all

4136224223127322134473877258888248126363443389877287728712537310
97*^0^0^p5?88*c1gd
0^9?3+9*4-+P$
I used a base9 + 23 encoding scheme, as it allowed me to represent everything without 0's.
The other thing I liked as abusing the c/$ operations rather than use two g's.

EDIT:
I got Very Small World! These two challenges really went hand-in-hand.
tails
Posts: 191
Joined: Tue Jun 10, 2008 7:51 pm
Location: Tokyo

Post by tails »

Congratulations on Very Small World.

And... Wow! How clever! I never thought that c/$ can be used this way!

Hmmm... I think I got some inspiration...
tails
Posts: 191
Joined: Tue Jun 10, 2008 7:51 pm
Location: Tokyo

Post by tails »

Sorry, I almost forgot to show my code.

This is my first solution, of length 97. It uses "calculated gotos" for branching.

Code: Select all

47607002324232463184706032707117476070123242324631484631466022229
88*^0^p0^9:97+*gd
4+9*+P0^9:96+*g
And this is 95. It has one instruction that is never executed at runtime, shown as "a".

Code: Select all

9761333393724732857161337162497797612323938247324947324761331300
79*^0^p0^5?88*cap
3+9*+P0^4?99*c
And I happened to make a code of length 93! It's a hybrid of therethinker's code and mine above (and so I won't claim the credit this time).
therethinker
Posts: 144
Joined: Fri Mar 28, 2008 11:29 pm
Location: #hacker.org on Freenode

Post by therethinker »

Can you post your len-93 code, or do I have to beat it first?

Interesting how you use `...:...*g`, it's a lot more compact than `...?`.
tails
Posts: 191
Joined: Tue Jun 10, 2008 7:51 pm
Location: Tokyo

Post by tails »

therethinker wrote:Can you post your len-93 code, or do I have to beat it first?
I must not rob you of the fun :)
therethinker
Posts: 144
Joined: Fri Mar 28, 2008 11:29 pm
Location: #hacker.org on Freenode

Post by therethinker »

Oh tails!

I've also been thinking of a more efficent encoding scheme. Given enough space, you should be able to encode 4 chars in 5 #'s, but it would require so much computation/lookup it probably wouldn't become efficient.

However, encoding 2 chars in 3 #'s might be possible if you find some simple way to map a 10x5=50 combinations to the required chars.
To break even, you'd have 15 chars to implement it in, which is reasonable. Again, its all in the mapping.
tog
Posts: 70
Joined: Fri Nov 14, 2008 11:23 am
Location: Germany

Post by tog »

Whooh, I got it! My major motivation was to read this thread ;) Very interesting solutions here. Especially the jump back using $ is great! My 93-solution actually has 4 useless instructions that I only added to get cheap targets for the c-calls.
tails
Posts: 191
Joined: Tue Jun 10, 2008 7:51 pm
Location: Tokyo

Post by tails »

Welcome, and congratulations, tog!

It's great that you achieved 93 independently, without using therethinker's $ technique. I'm very curious how you did it.
tog
Posts: 70
Joined: Fri Nov 14, 2008 11:23 am
Location: Germany

Post by tog »

Oh, nothing fancy. My break-through was to change the coding scheme from 8*4+x*9+y to (x+3)*9+y ... similar to your posted solutions. I just tried to integrate therethinker's $ technique. I tried to change my encoding scheme to include '$'. But I also only came up with subtracting 4, (similar to therethinker), which in the end eats the benefit.
tails
Posts: 191
Joined: Tue Jun 10, 2008 7:51 pm
Location: Tokyo

Post by tails »

... I'm afraid that this challenge will become too hard with my new solution of length 90.
Post Reply