1
Name:
Anonymous
2010-07-06 19:36
const char *s[15] = {
"%c%c%s%c%c%c",
"const char *s[15] = {",
"};",
"#include <stdio.h>",
"int main(void) {",
" int i;",
" puts(s[1]);",
" for (i=0; i<14; ++i)",
" printf(s[0], 9, 34, s[i], 34, 44, 10);",
" printf(s[0], 9, 34, s[i], 34, 0, 10);",
" puts(s[2]);",
" for (i=3; i<15; ++i)",
" puts(s[i]);",
" return 0;",
"}"
};
#include <stdio.h>
int main(void) {
int i;
puts(s[1]);
for (i=0; i<14; ++i)
printf(s[0], 9, 34, s[i], 34, 44, 10);
printf(s[0], 9, 34, s[i], 34, 0, 10);
puts(s[2]);
for (i=3; i<15; ++i)
puts(s[i]);
return 0;
}
the one I wrote.
4
Name:
Anonymous
2010-07-06 20:29
How long before some retard tries something inane like `cat $0`?
Oh wait
>>2 already did it.
Look, quines don't read their own program file as input. That's not a quine, that's just a program that reads itself.
5
Name:
Anonymous
2010-07-06 20:31
>>4
I argued that with the residents of esolang. I lost.
7
Name:
Anonymous
2010-07-06 20:35
>>6
Sure. But not both at the same time.
8
Name:
Anonymous
2010-07-06 21:14
infile = open(__file__, 'r')
for line in infile:
print line,
Expert python implementation.
11
Name:
Anonymous
2010-07-06 22:07
>>10
if
>>9 isn't a quine, then it's impossible to write a quine in any interpreted language.
12
Name:
Anonymous
2010-07-06 22:11
>>11
There are arguments against
>>9,8,4 that aren't applicable to
>>2 . My stance on these is "cares little."
13
Name:
Anonymous
2010-07-06 22:20
>>4
Technically a queue is a program that outputs it's own source code. Nothing specifically says it can't read it's own source as a file. These types of programs are still queues.
14
Name:
Anonymous
2010-07-06 22:37
>>13
That's not what a ``queue'' is, otherwise I don't feel like disagreeing with you.
17
Name:
Anonymous
2010-07-06 22:53
>>14
I know, it can be tiresome being a pedantic asshole.
20
Name:
Anonymous
2010-07-07 0:38
>>19
Well this one certainly doesn't qualify.
25
Name:
Anonymous
2010-07-07 9:08
>>22
No. In case I have to spell it out,
>>2 doesn't read its source file as a part of the algorithm contained within the source file. The others do.
28
Name:
Anonymous
2010-07-07 10:03
Here's one:
Interpreter is cat .
35
Name:
Anonymous
2010-08-16 21:02
I just wrote a 356 byte ELF quine and just had to revive this thread.
>>> import os
>>> os.popen("./quine").read() == open("quine").read()
True
>>> open("quine").read().encode("hex")
'7f454c4601010100000000000000000002000300010000008080040834000000c40000000000000034002000020028000400030001000000000000000080040800800408a8000000a8000000050000000010000001000000a8000000a8900408a890040802000000020000000600000000100000000000000000000000000000b9a890040881e9a8000000ba64010000b804000000bb01000000cd80b801000000bb00000000cd800000002e7368737472746162002e74657874002e6461746100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b000000010000000600000080800408800000002800000000000000000000001000000000000000110000000100000003000000a8900408a8000000020000000000000000000000040000000000000001000000030000000000000000000000aa0000001700000000000000000000000100000000000000'
36
Name:
Anonymous
2010-08-16 21:03
That's
7f454c4601010100000000000000000002000300010000008080040834000000c
40000000000000034002000020028000400030001000000000000000080040800
800408a8000000a8000000050000000010000001000000a8000000a8900408a89
0040802000000020000000600000000100000000000000000000000000000b9a8
90040881e9a8000000ba64010000b804000000bb01000000cd80b801000000bb0
0000000cd800000002e7368737472746162002e74657874002e64617461000000
00000000000000000000000000000000000000000000000000000000000000000
000000000000000000b0000000100000006000000808004088000000028000000
00000000000000001000000000000000110000000100000003000000a8900408a
80000000200000000000000000000000400000000000000010000000300000000
00000000000000aa0000001700000000000000000000000100000000000000
37
Name:
Anonymous
2010-08-16 21:19
Here's the first quine I ever wrote. Not very short, but it works.
char* e(char*s){char*r,*e;r=e=malloc(strlen(s)*2);while(*s){if(*s=='"'||*s=='\\')*(e++)='\\';*(e++)=*(s++);}*e=0;return r;}int main(){char*c="char* e(char*s){char*r,*e;r=e=malloc(strlen(s)*2);while(*s){if(*s=='\"'||*s=='\\\\')*(e++)='\\\\';*(e++)=*(s++);}*e=0;return r;}int main(){char*c=\"%s\";char*s=e(c);printf(c,s);free(s);return 0;}";char*s=e(c);printf(c,s);free(s);return 0;}
$ ./a.out | diff - quine.c
$
38
Name:
Anonymous
2010-08-16 21:59
I realize that Python is easymodo, but
x='x=%s;print x%%repr(x)';print x%repr(x)