1. Another quine

Hi again,

I know most of you are not interested at all in this, but I thought
someone might
like it: I've just made another program that prints itself on the
screen. Although
it is somewhat larger than my previous one (removing the comment and
making some
minor modifications, that one becomes 453 bytes long, while this one is
545 bytes
long), I think this one uses a more interesting method (?).

-- begin code

atom k,b constant q='"',s='\\',n='\n',r=q&s,z={s&q,s&s},a={
"atom k,b constant q='\"',s='\\\\',n='\\n',r=q&s,z={s&q,s&s},a={",
"}puts(1,a[1]&n&q)for o=1to length(a[1])do b=a[1][o]k=find(b,r)if k",
"then puts(1,z[k])else puts(1,b)end if end for for o=2to 4do",
"puts(1,q&','&n&q&a[o])end for puts(1,q)for o=2to 4do puts(1,n&a[o])end
for"
}puts(1,a[1]&n&q)for o=1to length(a[1])do b=a[1][o]k=find(b,r)if k
then puts(1,z[k])else puts(1,b)end if end for for o=2to 4do
puts(1,q&','&n&q&a[o])end for puts(1,q)for o=2to 4do puts(1,n&a[o])end
for

-- end code

Regards,
Davi Figueiredo
davitf at usa.net

new topic     » topic index » view message » categorize

2. Re: Another quine

Hi Davi,

This is sort of a recursive quine...

--
constant x="constant %s =", y="puts(1, %s)", z="length(%s)"
printf(1, sprintf("%s\"%s\\n\",\ny=\"%s\\n? x\\n%s\",\n"&
    "z=sprintf(y,{%s,%s+1,%s+%s})\n%s\n?x&z\n%s",
    {x,x,y,y,z,z,z,z,y,y}),
    "xx"&{"x[1..%d]","x[%d..%d]"}&"xxxyxz")
--

save this to a file called "one.ex"

ex one > two.ex
ex two > three.ex
ex three

The actual quine is three.ex.

Regards,
-- Pete




On Mon, 21 Aug 2000 23:05:44 -0300, Davi Tassinari de Figueiredo
<davitf at USA.NET> wrote:

>Hi again,
>
>I know most of you are not interested at all in this, but I thought
>someone might
>like it: I've just made another program that prints itself on the
>screen. Although
>it is somewhat larger than my previous one (removing the comment and
>making some
>minor modifications, that one becomes 453 bytes long, while this one is
>545 bytes
>long), I think this one uses a more interesting method (?).
>
>-- begin code
>
>atom k,b constant q='"',s='\\',n='\n',r=q&s,z={s&q,s&s},a={
>"atom k,b constant q='\"',s='\\\\',n='\\n',r=q&s,z={s&q,s&s},a={",
>"}puts(1,a[1]&n&q)for o=1to length(a[1])do b=a[1][o]k=find(b,r)if k",
>"then puts(1,z[k])else puts(1,b)end if end for for o=2to 4do",
>"puts(1,q&','&n&q&a[o])end for puts(1,q)for o=2to 4do puts(1,n&a[o])end
>for"
>}puts(1,a[1]&n&q)for o=1to length(a[1])do b=a[1][o]k=find(b,r)if k
>then puts(1,z[k])else puts(1,b)end if end for for o=2to 4do
>puts(1,q&','&n&q&a[o])end for puts(1,q)for o=2to 4do puts(1,n&a[o])end
>for
>
>-- end code
>
>Regards,
>Davi Figueiredo
>davitf at usa.net

new topic     » goto parent     » topic index » view message » categorize

3. Re: Another quine

Pete and Davi,  I found your quines very interesting. They fried my
synapses quite nicely. My latest creation is only 108 bytes, chasing the
heels of Andy Kurnia's 101 bytes. Any suggestions for shrinking this one
further?

 object x x="object x
[12..52])

 (This probably won't appear as 1 line in this message)

 Kind Regards,
 Aidan

new topic     » goto parent     » topic index » view message » categorize

4. Re: Another quine

Quine Lite,  only 70 bytes per serve:

object x x="object x x=%sprintf(1,x,{34&x&34})"printf(1,x,{34&x&34})

Regards,
Aidan

new topic     » goto parent     » topic index » view message » categorize

5. Re: Another quine

Aidan Bindoff wrote:
>Quine Lite,  only 70 bytes per serve

Very nice! I didn't think it would be possible to make a quine as small
as yours. Just a small modification to save another 2 bytes:

constant x="constant x=%sprintf(1,x,{34&x&34})"printf(1,x,{34&x&34})

Regards,
Davi Figueiredo
davitf at usa.net

new topic     » goto parent     » topic index » view message » categorize

6. Re: Another quine

>Very nice! I didn't think it would be possible to make a quine as small
>as yours. Just a small modification to save another 2 bytes:
>
>constant x="constant x=%sprintf(1,x,{34&x&34})"printf(1,x,{34&x&34})


Thanks Davi,  I think that just about reaches the limit?

Kind Regards,
Aidan

P.S  I think your suggestion is actually the same size, I tried "constant x"
initially.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu