Page 1 of 2

Mighty Quine

Posted: Thu Dec 18, 2008 6:51 pm
by tails
Hi! :D

Here is my code of length 90:

Code: Select all

1857161337162931347329761232393824732494732476133133232323200000
79*^0^p0^5?88*c
0^7?3+9*+P$
This code utilizes therethinker's $ technique. Each character is expressed in (x+3)*9+y, so "$" is expressed with x=0 and y=1. The sequence terminates with a 0 in the y position, so it is possible to use a 0 in the x position. And this code has extra "0"s for padding, in order to get the cheap targets for "^" and "c", and these "0"s are printed explicitly with x=2 and y=3.

In the previous challenge, I was trying to do it in 93 without using "$"s, but I couldn't. So I'm very curious in how tog did it, and also how his code is in 90 on this challenge.

Re: Mighty Quine

Posted: Thu Dec 18, 2008 7:01 pm
by tails
It seems I cannot edit the top post. I was said: "topic already exists: Mighty Quine" when trying to submit the edit.
tails wrote:"$" is expressed with x=0 and y=1. The sequence terminates with a 0 in the y position, so it is possible to use a 0 in the x position.
That was incorrect. The "$" is with x=1 and y=0. And the sequence terminates with a 0 in the x position, so it is possible to use a 0 in the y position.

Sorry for being careless.

Posted: Thu Dec 18, 2008 8:19 pm
by tog
OK, then here is my 93 code without the $-trick:

Code: Select all

111167319292554131926382174267318282413263921791191791173192721079*^0^p0^9?3+88*c4^8?9*+P99*c
The ones in the front are used for padding. The trick to get the cheap target for the second loop (99*c) was to pull out the 3+ which is added to both the x and y.

For my 90-solution I had to use the $-technique. In fact it is very similar to your solution:

Code: Select all

155413192635217916779124132638217911917911717914152318272910078*5+0^^0^p0^8?3+1vc0^5?9*+P$
The 78*5+ target (and its duplication via 0^ and 1v) are a bit ugly but just right to get it to 90.
And damn, I was *so* close to getting a 81- or 83-solution based on 69* and 78* targets instead of 79* and 88*. I tried several different variants. But every time I either had a single number too much on the stack, or one was missing, or the encoding of space or $ was just one off. For example, if $ was ASCII 35 instead of 36, it would have worked. But no success yet. :cry:

Posted: Fri Dec 19, 2008 3:35 am
by tails
Thank you for your codes, tog!

In order to use "99*c", I also thought of adding 3 in the first loop, but I just rejected it because I thought it couldn't be used together with 0 terminator, but your code is doing it. And checking the terminator by "4^" is also impressive.

And I didn't think we can use the same target for the "^" and "c" in the first loop, like this way. That's rather beautiful!

Posted: Fri Dec 19, 2008 6:48 am
by tog
Thank you for the feedback!

The terminator is also exactly the problem for the 81- or 83-solution. Because our encoding of $ includes a 0, we cannot use such simple padding (with "4^") here. That means, the string has to match exactly the code. And this is what I could not achieve with 59* or 67*-targets.

Posted: Fri Dec 19, 2008 6:10 pm
by tails
Yes we can! :D

I managed to make it in 82, using 69* and 78* targets as you said.

I don't feel we can squeeze any more.

Posted: Fri Dec 19, 2008 6:30 pm
by tog
OMG, in all the variants I tried, just a small bit did not fit. Can you just tell me if you needed a new encoding that didn't use a 0 for $? I'm really curious about this solution.

Posted: Fri Dec 19, 2008 6:50 pm
by tails
I also tried many variants, such as y-(12*x), but after all my code had "3+9*+P" sequence. So, a 0 is used for $. But I used a new trick to shorten the data.

Posted: Fri Dec 19, 2008 7:19 pm
by tog
Yeah, I have also tried the y-a*x encoding, also without success. I am also aware of one trick to shorten the data, but so far it only let me print a space, which I could not use.

Posted: Sun Dec 21, 2008 7:30 pm
by tog
tails wrote:Yes we can! I don't feel we can squeeze any more.
This is not the end, my friend! :D

I got a quine with only 81 instructions. Not that much of an improvement ... but in fact I was pretty close to a 75-length solution, for which I only had one instruction too much. What about another challenge? :wink:

Posted: Sun Dec 21, 2008 9:53 pm
by adum
81, nice. can you submit it as a solution to mighty quine, and i'll shrink the limit please?

Posted: Sun Dec 21, 2008 9:58 pm
by tog
Yes, of course! :lol:

Posted: Mon Dec 22, 2008 12:18 am
by adum
all righty, 81 it is to beat now =)

Posted: Mon Dec 22, 2008 1:10 am
by tails
OMG! :)

This is my 82 length solution:

Code: Select all

9392458171633172674247916323139317423947423741633295530 69*^0^p0^7?78*c1^3+9*+P1?$
75... :shock:

Posted: Mon Dec 22, 2008 10:49 am
by tails
I think I have caught up to you, tog.

Code: Select all

15541171231926372677912413263621791191791171791319262069*0^^0^p0^6?3+1vc7?9*1^+P$