1. Quine - a program that replicates itself
- Posted by Aidan Bindoff <abindoff at ONE.NET.AU> Aug 18, 2000
- 532 views
------=_NextPart_000_0009_01C0091B.3F2489A0 charset="iso-8859-1" Here's an interesting brain teaser - writing a quine in Euphoria. For those of you that don't know what a quine is: A Quine is a program that replicates itself exactly. A program that copies it's own code from disk does not count. I have attached my first quine if you are interested. This program takes advantage of Euphoria's native atom/sequence structure, and methods of displaying sequences. It does not write to disk, just to the monitor. I would be interested in seeing different quines in Euphoria. Euphoria's handling of sequences lends itself to many potential variations of quine. Kind Regards, Aidan. ------=_NextPart_000_0009_01C0091B.3F2489A0 name="Quine.ex" Content-Transfer-Encoding: quoted-printable
2. Re: Quine - a program that replicates itself
- Posted by Pete Eberlein <xseal at HARBORSIDE.COM> Aug 18, 2000
- 501 views
Been there, done that :) Pete On Fri, 18 Aug 2000 13:50:19 +1000, Aidan Bindoff <abindoff at ONE.NET.AU> wrote: >Here's an interesting brain teaser - writing a quine in Euphoria. For those >of you that don't know what a quine is: A Quine is a program that replicates >itself exactly. A program that copies it's own code from disk does not >count. >I have attached my first quine if you are interested. This program takes >advantage of Euphoria's native atom/sequence structure, and methods of >displaying sequences. It does not write to disk, just to the monitor. > >I would be interested in seeing different quines in Euphoria. Euphoria's >handling of sequences lends itself to many potential variations of quine. > >Kind Regards, >Aidan. >
3. Re: Quine - a program that replicates itself
- Posted by Davi Tassinari de Figueiredo <davitf at USA.NET> Aug 19, 2000
- 511 views
Hi, I tried to create a self-replicating program some weeks ago. I decided not to use numbers to represent characters (such as writing '34' instead of a quote); I thought it was not a very "elegant" approach. Here is the program I wrote: -- begin code -- This is a self-replicating program constant s='\\',n='\n',q='\"',t="%s",x=t&q&n&'&'&q, msg="This is a self-replicating program", l1="%s-- %sconstant s='%s',n='%sn',q='%s',t=%s,x=t&q&n&'&'&q,%s", &"puts(1,%smsg=%s&q&msg&q&','&n)%s" &"printf(1,l2,{{},n,q,q,n,q,q,n,q,q,n,n})%s" printf(1,l1,{{},msg&n,s&s,s,s&q,q&t&q,n}) puts(1,"msg="&q&msg&q&','&n) printf(1,"l1="&l1,{q&t,t,t,t,t,t,t&q&','&n}) printf(1,l2,{{},n,q,q,n,q,q,n,q,q,n,n}) -- end code I hope you like it ;) Regards, Davi Figueiredo davitf at usa.net
4. Re: Quine - a program that replicates itself
- Posted by Aidan Bindoff <abindoff at ONE.NET.AU> Aug 19, 2000
- 536 views
> constant s='\\',n='\n',q='\"',t="%s",x=t&q&n&'&'&q, > msg="This is a self-replicating program", > l1="%s-- %sconstant s='%s',n='%sn',q='%s',t=%s,x=t&q&n&'&'&q,%s", > l2="%sprintf(1,l1,{{},msg&n,s&s,s,s&q,q&t&q,n})%s" > &"puts(1,%smsg=%s&q&msg&q&','&n)%s" > &"printf(1,%sl1=%s&l1,{q&t,t,t,t,t,t,t&q&','&n})%s" > &"printf(1,%sl2=%s&l2,{q&t,x,t,t,x,t,t,x,t,t,x,t&q&n})%s" > &"printf(1,l2,{{},n,q,q,n,q,q,n,q,q,n,n})%s" > printf(1,l1,{{},msg&n,s&s,s,s&q,q&t&q,n}) > puts(1,"msg="&q&msg&q&','&n) > printf(1,"l1="&l1,{q&t,t,t,t,t,t,t&q&','&n}) > printf(1,"l2="&l2,{q&t,x,t,t,x,t,t,x,t,t,x,t&q&n}) > printf(1,l2,{{},n,q,q,n,q,q,n,q,q,n,n}) > I hope you like it ;) > > Regards, > Davi Figueiredo > davitf at usa.net > Davi, very nice. More elegant? "This is a self-replicating program" is pretty brassy! Kind Regards, Aidan.
5. Re: Quine - a program that replicates itself
- Posted by "Darth Maul, aka Matt" <Uglyfish87 at HOTMAIL.COM> Aug 23, 2000
- 530 views
So it prints its code out. Whoop dee doo
6. Re: Quine - a program that replicates itself
- Posted by Aidan Bindoff <abindoff at ONE.NET.AU> Aug 24, 2000
- 543 views
>So it prints its code out. Whoop dee doo > So you run around a post-apocolyptic city with an assortment of guns. Whoop dee doo