Skip to main content
gamedev.net
🔒 Locked

Very Smart Programming Riddle

Started by Semion_N Jun 8, 2006 at 11:33 PM 4 replies 1.3k views
Original Post
Semion_N
Semion_N
Hello, I saw in one of the forums quite smart riddle: You should write a program which writes itself. This question and answer raised in very interesting article. If you want the article just ask but first- try to answer it by yourself.
Ravuya
Ravuya
Programs that write themselves out are called quines, and there have been several of them out there for almost any language.
bibiskuk
bibiskuk
In perl, Yeah, i know, i cheat :)

#!/usr/bin/perlseek DATA,SEEK_SET,0; print <DATA>;__DATA__
Beer Hunter
Beer Hunter
Quines are pretty straightforward in most languages. Write a program that prints a string twice, make the string the same as the code, and tweak it a little.
Rob Loach
Rob Loach
More information on quines is available from Wikipedia. It has two sample quines written in both C and BASIC.
Rob Loach [Website] [Projects] [

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.