Forum Articles
  Welcome back Join CF
You are here You are here: Home | Forum | DVD factory 3 not launching ???

You are currently viewing our boards as a guest which gives you limited access to view most of the discussions, articles and other free features. By joining our Virgin Media community you will have full access to all discussions, be able to view and post threads, communicate privately with other members (PM), respond to polls, upload your own images/photos, and access many other special features. Registration is fast, simple and absolutely free so please join our community today.


Welcome to Cable Forum
Go Back   Cable Forum > Computers & IT > General IT Discussion
Register FAQ Community Calendar

Quine - self replicating code
Reply
 
Thread Tools
Old 24-09-2005, 22:42   #1
ikthius
Inactive
 
ikthius's Avatar
 
Join Date: Mar 2004
Location: Glasgow, Scotland
Services: anything for a new job
Posts: 4,165
ikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronze
ikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronze
Quine - self replicating code

ok,

I was shown this today and asked to try it out by a friend, so far what I can come up with might fail, I will get it eventually

but, I was going to see how many people would like to try it.

http://www.nyx.net/~gthompso/quine.htm
http://en.wikipedia.org/wiki/Quine

it can be done in most programming languages.

try to do it without cheating.

ik

p.s. I searched the forum for this, and it only came up with a quiz, so nothing else has been posted, i think
ikthius is offline   Reply With Quote
Advertisement
Old 25-09-2005, 00:39   #2
danielf
cf.mega poser
 
danielf's Avatar
 
Join Date: Jun 2003
Posts: 16,687
danielf has a golden auradanielf has a golden auradanielf has a golden aura
danielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden aura
Re: Quine - self replicating code

Quote:
Originally Posted by ikthius
ok,

I was shown this today and asked to try it out by a friend, so far what I can come up with might fail, I will get it eventually

but, I was going to see how many people would like to try it.

http://www.nyx.net/~gthompso/quine.htm
http://en.wikipedia.org/wiki/Quine

it can be done in most programming languages.

try to do it without cheating.

ik

p.s. I searched the forum for this, and it only came up with a quiz, so nothing else has been posted, i think
Great to see someone bring this up! (I hosted that quiz btw). They're mind boggling, those quines...

I use LISP on an almost daily basis, but I really cannot get myself to understand this (allegedly) classic quine:

((lambda (x)
(list x (list (quote quote) x)))
(quote
(lambda (x)
(list x (list (quote quote) x)))))

I'm not sure it counts though, as (in CLISP) some quotes become 's as below

[11]> ((lambda (x)
(list x (list (quote quote) x)))
(quote
(lambda (x)
(list x (list (quote quote) x)))))
((LAMBDA (X) (LIST X (LIST 'QUOTE X))) '(LAMBDA (X) (LIST X (LIST 'QUOTE X))))
[12]>
__________________
Remember kids: We are blessed with a listening, caring government.
danielf is offline   Reply With Quote
Old 25-09-2005, 14:26   #3
ikthius
Inactive
 
ikthius's Avatar
 
Join Date: Mar 2004
Location: Glasgow, Scotland
Services: anything for a new job
Posts: 4,165
ikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronze
ikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronzeikthius is cast in bronze
Re: Quine - self replicating code

I done it in java, although I am not convinced it is an exact replica, but it is close.

I was thinking about also finding the file and echoing the file to the screen, not sure if this is against the rules?

Code:
class QuineTest
{
	public static void main(String [] args)
	{
		char x = 32;
		System.out.println(y+x+';'+'}');
	}
	static String y ="class QuineTest{ public static void main(String [] args){ char x = 34; System.out.println(y+x+';'+'}');} static String y =";
	
}
although my code to make it work is not on the same line, I thought it would be easier this way, but you know it can be all put on the same line.

ik
ikthius is offline   Reply With Quote
Old 26-09-2005, 01:01   #4
danielf
cf.mega poser
 
danielf's Avatar
 
Join Date: Jun 2003
Posts: 16,687
danielf has a golden auradanielf has a golden auradanielf has a golden aura
danielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden auradanielf has a golden aura
Re: Quine - self replicating code

That looks pretty impressive! I don't know Java though, so I haven't a clue as to what it does

But don't you have an additional semicolon in the output (last character)?
__________________
Remember kids: We are blessed with a listening, caring government.
danielf is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 15:07.


Server: osmium.zmnt.uk
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum