A code-bowling is not the same as a code-golf, in a Code-Bowling, you should solve the challenge in as many characters as possible. The goal of this Code-Bowling is to create a quine in as many characters as possible, but you still should try to remove redundant characters. For example, don't post a HQ9+ solution with 10,000,000 times the +
character, because the code still works if you remove them. Also, don't use variables with a name of 100 characters long, because you could easily rename them to a name of one character.
Because this is a popularity-contest, the highest-voted answer wins. With 'redundant characters', I mean characters that can be removed, but the code will still work after removing them.
-
\$\begingroup\$ So, if you use a language which supports the null quine (an empty file), are all characters redundant? \$\endgroup\$– boothbyJan 6, 2014 at 23:02
-
\$\begingroup\$ @boothby: There are no characters, so they can't be redundant. Anyway, you won't win if you post a null quine. \$\endgroup\$– ProgramFOXJan 7, 2014 at 17:25
-
\$\begingroup\$ No. I mean: Python supports a null quine. Therefore, I believe that any quine written in Python is 100% redundant: you can delete all of its characters and the result is a quine. \$\endgroup\$– boothbyJan 7, 2014 at 19:38
-
\$\begingroup\$ @boothby: I don't treat all characters in a language that supports a null quine as redundant characters. \$\endgroup\$– ProgramFOXJan 8, 2014 at 14:30
-
\$\begingroup\$ I think that you should specify that all characters should be directly related to the execution of the quine code, so padding with whitespace, comments, useless string data, etc is disallowed. \$\endgroup\$– SammitchJan 9, 2014 at 18:21
7 Answers
Brainfuck: 153,191 bytes
This is probably my largest BF binary. It prints it's own source including the intro text which is the Norwegian fairy tail The three billy goats Gruff (De tre bukkene Bruse). You cannot remove the story without removing the generating code so this Quine is designed to tell a story!
bf
(A well known interpreter on Debian based linux distros) has too few cells by default so start it with:
bf -c35724 billy-quine.bf
Since StackExchange has a 30K limit I had to put it somewhere else. Beginning of the file follows:
[
Once upon a time there were three billy goats, names Gruff. They were on their
way to eat on the hillside, but they had to cross a bridge. Under the bridge
lived a troll, with eyes as big as saucers, and a nose as long as a poker.
The first goat over the bridge was the youngest Billy Goat Gruff. "Trip, trap,
trip, trap!" he walked across the bridge.
"Who's that tripping over my bridge?" roared the troll.
"I am the smallest Billy Goat Gruff, and I'm going up to the hillside to make
myself fat," said the billy goat, with a tiny voice.
"I'm coming to gobble you up," said the troll.
"Oh, no! please don't eat me. I'm too little!" said the billy goat. "Wait for
the second Billy Goat Gruff. He's much bigger."
"Well, be off with you," said the troll.
A little while later, the second Billy Goat Gruff crossed the bridge. "Trip,
trap, trip, trap, trip, trap" went the bridge.
"Who's that tripping over my bridge?" roared the troll.
"I am the second Billy Goat Gruff, and I'm going up to the hillside to make
myself fat," said the billy goat, with a medium voice.
"I'm coming to gobble you up," said the troll.
"Oh, no! Don't eat me. Wait for the last Billy Goat Gruff. He's much bigger."
"Very well! Be off with you," said the troll.
Next, the big Billy Goat Gruff crossed the bridge. "Trip, trap, trip, trap,
trip, trap!" went the bridge. This billy goat was heavy and the bridge creaked
and groaned under him.
"Who's that tramping over my bridge?" roared the troll.
"I am the big Billy Goat Gruff ," said the billy goat, with a big ugly voice.
"I 'm coming to gobble you up," roared the troll.
"No, you're not!" said the biggest Billy Goat Gruff. "I am bigger than you and
I could crush you into bits and bones."
"No, you're not!" said the biggest Billy Goat Gruff. "I am bigger than you and
I could crush you into bits and bones."
And when the troll saw how big the billy goat was, the troll let him pass. After
that, the three billy goats went to the hillside. They got so fat they could
hardly walk home. And if the fat hasn't fallen off, they're still fat; and so,
Snip, snap, snout. This tale's told out.
]
->>>>++++>++>++>>++++>++>+++>++>++++>++>++>+++++>+++>++>++++++>++>++++>+>+>+++>+>+>++++>+>+++>+>+>++++>++>++++>++>+++>++>++++>++>++>+++>>++++>+>+>+++>+>+>++++>+>+++>+>+>+++++>+++>+++++>+++>++>++>>++++>++>++>+++>+++++>+>+>>+>+>+>+>>>>+>+>>+>+>+++++>+++++>+>+>+>+>+++++>+++++>+>+>++++>++>++>++>++>++>++>++>++>++>++>++>++>++>++>++>++>>+>+>>+>+>>+>+>>>+>+>>>+>+>+>+++++>+>+>+>>+>+>+++++>+++>>>++>++++>++>++>++>++>++>>+>+>>+>+>+>+++++>+++>++>++++>>+>+>+>++++>++>>+>+++++>+++>++>++++>++>>+>+++++>+++>++++++>+>+>>++>++>++>++++>+>+>+>>++>++++++>++>++>+++++>+++>+++++>+++>>+>++++++>++++++>++++++>++++++>+++++>+>+++++>+++++>+>++++>++>++>>>>>>>>+>>>>>>+>+++++>+++>>>>>>>>>>+>++++>>++>+++++>+++>>++>++>++>++>++++++>+>++++>++>>>>>>>>>>+>+++++>+++>>>>>>+>++++>++++>++>++>+++++>+++++>+++>>>+>+++++>++++>>++>+++++>+++>+++>>++++>+++++>+++>++++++>+++++>+++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>>+>++++++>>>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>>+>++++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>+>++++++>>>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>+>++++++>+++++>++++++>>>>>>>++++++>+++++>+++++>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>>+>++++++>+++++>+++++>+++++>+++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>+>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>+++++>+++++>+++++>++++++>+++++>+++++>+++++>+++++>+++++>++++++>>>>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>>+>++++++>+++++>+++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>>+>++++++>>>>>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>+>++++++>>>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>+>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>>>>>>>>>>>>++++++>>++>++++>+>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>+>++++++>>>>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>>+>++++++>+++++>+++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>>+>++++++>>>>>>>>>>>++++++>>++++++>++>++++>+>>>>>>++>+++++>+++>>>>>+>++++++>>>>++>++++>+>>>>>>>>++>+++++>+++>>>>>>>>+>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>>>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>+>++++++>+++++>++++++>>>>>>>++++++>>++++++>+++++>+++++>+++++>+++++>+++++>++++++>>>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>>+>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>+++++>+++++>+++++>+++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>+>++++++>+++++>++>++++>+>>>>>++>+++++>+++>>>>>+>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>+++++>+++++>+++++>+++++>+++++>++++++>>>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>>+>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>+++++>+++++>+++++>+++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>+>++++++>>>>>>>>++++++>+++++>+++++>+++++>+++++>+++++>++++++>>>++>++++>+>>>>>>++>+++++>+++>>>>>>+>++++++>>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>+>++++++>++++++>>>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>+>++++++>+++++>+++++>+++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>+>++++++>+++++>+++++>+++++>+++++>++++++>>>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>>+>++++++>+++++>+++++>+++++>+++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>+>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>>>>>>>>>>>>>>++++++>>++>++++>+>>>>>>>>>++>+++++>+++>>>>>>>>>+>++++++>+++++>+++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>+>++++++>+++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>+>++++++>+++++>++>++++>+>>>>>>++>+++++>+++>>>>>+>++++++>+++++>+++++>+++++>+++++>+++++>++++++>+++++>+++++>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>+>++++++>+++++>+++++>+++++>+++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>+>++++++>++++++>>>>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>>++++++>>>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>>+>++++++>>>>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>+>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>>>>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>+>++++++>+++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>>+>++++++>++>++++>+>>>>>>++>+++++>+++>>>>>+>++++++>+++++>+++++>+++++>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>>>>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>>+>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>+++++>+++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>+>++++++>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>+++++>+++++>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>>+>++++++>>>>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>>+>++++++>>>>>>>>>>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>++++++>>>>>>>>>>>>++++++>+++++>+++++>+++++>+++++>+++++>++++++>+++++>+++++>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>+>++++++>+++++>+++++>+++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>>+>++++++>>>>>>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>+>++++++>>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>+>++++++>+++++>+++++>+++++>+++++>+++++>++++++>>>++>++++>+>>>>>++>+++++>+++>>>>>+>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>+>++++++>+++++>+++++>+++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>>+>++++++>+++++>++>++++>+>>>>>>++>+++++>+++>>>>>+>++++++>+++++>+++++>+++++>+++++>+++++>++++++>+++++>+++++>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>+>++++++>>>>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>+>++++++>+++++>+++++>+++++>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>>>>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>>+>++++++>>>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>+>++++++>+++++>+++++>+++++>++++++>>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>+>++++++>+++++>+++++>+++++>+++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>+>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>>>>++>++++>+>>>>>>>>++>+++++>+++>>>>>>>+>++++++>>>>++>++++>+>>>>>>>++>+++++>+++>>>>>>+>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>+>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>+++++>+++++>++++++>>>>>>>>++++++>++>++++>+>>>>>>>>>>++>+++++>+++>>>>>>>>>+>++++++>+++++>+++++>+++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>+>++++++>+++++>++++++>>>>>>>>>>>>++++++>+++++>+++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>+>++++++>+++++>+++++>+++++>++>++++>+>>>>>>>>>>>++>+++++>+++>>>>>>>>>>+>++++++>>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>>+>++++++>>>>>>>>>>>>>>++++++>>>>>>>>>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>>++>++++>+>>>>>++>+++++>+++>>>>>+>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>>>>>++>++++>+>>>>>>>>>>>++>+++++>+++>>>>>>>>>>+>++++++>+++++>+++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>+>++++++>+++++>+++++>+++++>+++++>++>++++>+>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++>+++++>+++>>>>>>>>>+>++++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>+++++>++++++>+++++....
-
\$\begingroup\$ Looks great, but which interpreter do you use? I used an online interpreter and I got a sequence of unicode characters. \$\endgroup\$ Jan 11, 2014 at 10:43
-
\$\begingroup\$ @ProgramFOX Any BF that has at least 35724 cells work. I use
bf
in my answer, but I also got this online interpreter to work, but it's a tad slow. \$\endgroup\$ Jan 11, 2014 at 12:56 -
\$\begingroup\$ Yes, that works! I'll accept your answer because I don't think someone will post a larger code, but if someone does, then I'll change my accept vote. \$\endgroup\$ Jan 11, 2014 at 13:05
Java 2286+
This can be expanded easily by including lowercase class names and then moving on to unicode characters. I do believe that there are no redundant characters. However, you could replace characters to simplify this (If this is allowed, then no solution here will win because you could simply replace every character and get the shortest quine for the language). This is a true quine, with no sort of reading code.
Redundant characters removed version:
class Z{String s(){char q=34;String t="class Z{String s(){char q=34;String t=;t=t.substring(0,38)+q+t+q+t.substring(38);return t;}}class Y{String s(){return new Z().s();}}class X{String s(){return new Y().s();}}class W{String s(){return new X().s();}}class V{String s(){return new W().s();}}class U{String s(){return new V().s();}}class T{String s(){return new U().s();}}class S{String s(){return new T().s();}}class R{String s(){return new S().s();}}class P{String s(){return new R().s();}}class O{String s(){return new P().s();}}class N{String s(){return new O().s();}}class M{String s(){return new N().s();}}class L{String s(){return new M().s();}}class K{String s(){return new L().s();}}class J{String s(){return new K().s();}}class I{String s(){return new J().s();}}class H{String s(){return new I().s();}}class G{String s(){return new H().s();}}class F{String s(){return new G().s();}}class E{String s(){return new F().s();}}class D{String s(){return new E().s();}}class C{String s(){return new D().s();}}class B{String s(){return new C().s();}}class A{public String toString(){return new B().s();}}public class Q{public static void main(String...a){System.out.print(new A());}}";t=t.substring(0,38)+q+t+q+t.substring(38);return t;}}class Y{String s(){return new Z().s();}}class X{String s(){return new Y().s();}}class W{String s(){return new X().s();}}class V{String s(){return new W().s();}}class U{String s(){return new V().s();}}class T{String s(){return new U().s();}}class S{String s(){return new T().s();}}class R{String s(){return new S().s();}}class P{String s(){return new R().s();}}class O{String s(){return new P().s();}}class N{String s(){return new O().s();}}class M{String s(){return new N().s();}}class L{String s(){return new M().s();}}class K{String s(){return new L().s();}}class J{String s(){return new K().s();}}class I{String s(){return new J().s();}}class H{String s(){return new I().s();}}class G{String s(){return new H().s();}}class F{String s(){return new G().s();}}class E{String s(){return new F().s();}}class D{String s(){return new E().s();}}class C{String s(){return new D().s();}}class B{String s(){return new C().s();}}class A{public String toString(){return new B().s();}}public class Q{public static void main(String...a){System.out.print(new A());}}
Readable version:
class Z{
String s(){
char q=34;
String t="class Z{String s(){char q=34;String "
+ "t=;t=t.substring(0,38)+q+t+q+t.substring(38);"
+ "return t;}}class Y{String s(){return new Z().s();"
+ "}}class X{String s(){return new Y().s();}}"
+ "class W{String s(){return new X().s();}}"
+ "class V{String s(){return new W().s();}}"
+ "class U{String s(){return new V().s();}}"
+ "class T{String s(){return new U().s();}}"
+ "class S{String s(){return new T().s();}}"
+ "class R{String s(){return new S().s();}}"
+ "class P{String s(){return new R().s();}}"
+ "class O{String s(){return new P().s();}}"
+ "class N{String s(){return new O().s();}}"
+ "class M{String s(){return new N().s();}}"
+ "class L{String s(){return new M().s();}}"
+ "class K{String s(){return new L().s();}}"
+ "class J{String s(){return new K().s();}}"
+ "class I{String s(){return new J().s();}}"
+ "class H{String s(){return new I().s();}}"
+ "class G{String s(){return new H().s();}}"
+ "class F{String s(){return new G().s();}}"
+ "class E{String s(){return new F().s();}}"
+ "class D{String s(){return new E().s();}}"
+ "class C{String s(){return new D().s();}}"
+ "class B{String s(){return new C().s();}}"
+ "class A{public String toString(){return new B().s();}}"
+ "public class Q{public static void main(String...a){System.out.print(new A());}}";
t=t.substring(0,38)+q+t+q+t.substring(38);
return t;
}
}
class Y{
String s(){
return new Z().s();
}
}
class X{
String s(){
return new Y().s();
}
}
class W{
String s(){
return new X().s();
}
}
class V{
String s(){
return new W().s();
}
}class U{
String s(){
return new V().s();
}
}
class T{
String s(){
return new U().s();
}
}
class S{
String s(){
return new T().s();
}
}
class R{
String s(){
return new S().s();
}
}
class P{
String s(){
return new R().s();
}
}
class O{
String s(){
return new P().s();
}
}
class N{
String s(){
return new O().s();
}
}
class M{
String s(){
return new N().s();
}
}
class L{
String s(){
return new M().s();
}
}
class K{
String s(){
return new L().s();
}
}
class J{
String s(){
return new K().s();
}
}
class I{
String s(){
return new J().s();
}
}
class H{
String s(){
return new I().s();
}
}
class G{
String s(){
return new H().s();
}
}
class F{
String s(){
return new G().s();
}
}
class E{
String s(){
return new F().s();
}
}
class D{
String s(){
return new E().s();
}
}
class C{
String s(){
return new D().s();
}
}
class B{
String s(){
return new C().s();
}
}
class A{
public String toString(){
return new B().s();
}
}
public class Q{
public static void main(String...a){
System.out.print(new A());
}
}
Python 2, jiggabytes.
Here's a small variant. I'd use some dataset like all the phone conversations in the world over the last 6 months, but some jackass can't figure out power to the building. Oh, and they haven't responded to my FOIA* request.
s='Another one got caught today, it\'s all over the papers. "Teenager Arrested in Computer Crime Scandal", "Hacker Arrested after Bank Tampering"...\n\nDamn kids. They\'re all alike.\n\nBut did you, in your three-piece psychology and 1950\'s technobrain, ever take a look behind the eyes of the hacker? Did you ever wonder what made him tick, what forces shaped him, what may have molded him?\n\nI am a hacker, enter my world...\n\nMine is a world that begins with school... I\'m smarter than most of the other kids, this crap they teach us bores me...\n\nDamn underachiever. They\'re all alike.\n\nI\'m in junior high or high school. I\'ve listened to teachers explain for the fifteenth time how to reduce a fraction. I understand it. "No, Ms. Smith, I didn\'t show my work. I did it in my head..."\n\nDamn kid. Probably copied it. They\'re all alike.\n\nI made a discovery today. I found a computer. Wait a second, this is cool. It does what I want it to. If it makes a mistake, it\'s because I screwed it up. Not because it doesn\'t like me... Or feels threatened by me.. Or thinks I\'m a smart ass.. Or doesn\'t like teaching and shouldn\'t be here...\n\nDamn kid. All he does is play games. They\'re all alike.\n\nAnd then it happened... a door opened to a world... rushing through the phone line like heroin through an addict\'s veins, an electronic pulse is sent out, a refuge from the day-to-day incompetencies is sought... a board is found. "This is it... this is where I belong..." I know everyone here... even if I\'ve never met them, never talked to them, may never hear from them again... I know you all...\n\nDamn kid. Tying up the phone line again. They\'re all alike...\n\nYou bet your ass we\'re all alike... we\'ve been spoon-fed baby food at school when we hungered for steak... the bits of meat that you did let slip through were pre-chewed and tasteless. We\'ve been dominated by sadists, or ignored by the apathetic. The few that had something to teach found us willing pupils, but those few are like drops of water in the desert.\n\nThis is our world now... the world of the electron and the switch, the beauty of the baud. We make use of a service already existing without paying for what could be dirt-cheap if it wasn\'t run by profiteering gluttons, and you call us criminals. We explore... and you call us criminals. We seek after knowledge... and you call us criminals. We exist without skin color, without nationality, without religious bias... and you call us criminals. You build atomic bombs, you wage wars, you murder, cheat, and lie to us and try to make us believe it\'s for our own good, yet we\'re the criminals.\n\nYes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like. My crime is that of outsmarting you, something that you will never forgive me for.\n\nI am a hacker, and this is my manifesto. You may stop this individual, but you can\'t stop us all... after all, we\'re all alike.\n;from hashlib import*;h=new("sha512");h.update(`s`);h=h.digest().encode("base64");print(%r==h)*(\'s=\'+`s`+s[2952:]%%h)';from hashlib import*;h=new("sha512");h.update(`s`);h=h.digest().encode("base64");print('25eLAyYiA1nZPZQ6u0QwdIcPdypqedXDgGtwY1E7R1cYo6amjKxOl18rmmyGBMHyzW7tQPjYziOk\nXNQd+Egpeg==\n'==h)*('s='+`s`+s[2952:]%h)
How it works
The quine starts by defining a string s
which contains a payload followed by the quine code. You'd like to delete that junk to golf the quine. But you can't, because the quine contains a cryptographically strong hash of s
. If the hash of s
doesn't match that in the quine, it doesn't print.
Initially, I'd used this article for the payload but a government conspiracy** prevented me from pasting in the 34k program. The choice of article was not random: the NSA may know how to delete characters from this quine to preserve the hash. So, I used the Hacker Manifesto. Not that I'm actually that kind of hacker... but it seemed appropriate to draw an analogy.
To really beef up security, I even included the length of the hashed string. As everybody knows, this makes hashes like a million million times more secure. But this is even better than that, because you'd have to delete some subset of the length if you've deleted some of the hashed text.
Here's the prequine.
s=open("anyfile").read()
t=""";from hashlib import*;h=new("sha512");h.update(`s`);h=h.digest().encode("base64");print(%%r==h)*('s='+`s`+s[%d:]%%%%h)"""%len(s)
from hashlib import*
h=new('sha512')
h.update(`s+t`)
h=h.digest().encode('base64')
print"s="+`s+t`+t%h
*BTLT+JTWAQFZC3zIr29pQO6BbKSz6lNS7vqbyrLj8osjiphxgkgr9GsySFBMp0ZCor8aTVc94Xdji4KaSX543Q==
** Or, y'know, because it was over the site size limit for a post.
-
\$\begingroup\$ Looks great, but it gives a syntax error. \$\endgroup\$ Jan 10, 2014 at 16:26
-
\$\begingroup\$ @ProgramFOX I don't... perhaps it's a copy&paste issue? Maybe you should try the prequine. \$\endgroup\$– boothbyJan 10, 2014 at 18:22
-
\$\begingroup\$ Again a syntax error. I'm using Python 3.3 on Windows. \$\endgroup\$ Jan 10, 2014 at 18:35
-
\$\begingroup\$ @ProgramFOX ah, that'd be the print statement. Use a python 2 later than 2.5. \$\endgroup\$– boothbyJan 10, 2014 at 21:27
Ruby, 2242 (I could have made it as long as I want)
require 'open-uri'
puts open('http://pastebin.com/raw.php?i=pQRy8Mn8').read
#aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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ldn't With 'redundant characters', I mean characters that can be removed, but the code will still work after removing them. apply to comments? \$\endgroup\$ Dec 30, 2013 at 13:40
-
\$\begingroup\$ @Kyle None of the characters are redundant. If you remove the comments, it doesn't work. \$\endgroup\$– DoorknobDec 30, 2013 at 14:09
-
\$\begingroup\$ Perhaps it is because I don't use Ruby, but I get
#<StringIO:0x7ff7d2181bf0>
(or other address) as output in both my IDE and terminal. What is supposed to occur? \$\endgroup\$ Dec 30, 2013 at 14:26 -
\$\begingroup\$ @Kyle Oops, sorry,I didn't actually test it (since I'm answering from my phone right now) fixed (and updated pastebin) \$\endgroup\$– DoorknobDec 30, 2013 at 14:28
-
1\$\begingroup\$ Interesting solution, but it is not a true quine (It reads its own source code, well a copy of it anyways). +1 \$\endgroup\$– JustinDec 30, 2013 at 18:59
Fortran - 1359
program quine
character(len=48)::l(16),n
integer::i,j,k
data l/&
'program quine ',&
' character(len=48)::l(16),n ',&
' integer::i,j,k ',&
' data l/& ',&
' do i=1,4;print*,l(i);enddo ',&
' do i=1,15 ',&
' n=l(i);j=index(n,'''''''');k=0 ',&
' do while(j/=0) ',&
' n=n(:k+j-1)//''''''''//n(k+j:47) ',&
' k=k+j+1;j=index(n(k+1:),'''''''') ',&
' enddo ',&
' print*,'' '''''',n,'''''',&'' ',&
' enddo ',&
' print*,'' '''''',l(16),''''''/'' ',&
' do i=5,16;print*,l(i);enddo ',&
'end program quine '/
do i=1,4;print*,l(i);enddo
do i=1,15
n=l(i);j=index(n,'''');k=0
do while(j/=0)
n=n(:k+j-1)//''''//n(k+j:47)
k=k+j+1;j=index(n(k+1:),'''')
enddo
print*,' ''',n,''',&'
enddo
print*,' ''',l(16),'''/'
do i=5,16;print*,l(i);enddo
end program quine
I might try bloating this some, but I don't think I can do that. Note that this is an adapted version of this code to satisfy the non-redundancy.
Python - infinity
print(r"print(r"print(r"print ...
And so on and so forth...
-
\$\begingroup\$ Isn't this just a syntax error? Even if it works, aren't most of those
print
s redundant (contrary to the requirements in the specs: remove redundant characters). \$\endgroup\$– JustinFeb 15, 2014 at 3:53
Pascal
source code 2479 bytes, so code is about 2300 char, too lazy to count :)
program as;
var
st : array[1..18] of string;
i,j : integer;
begin
st[1] := #112+#114+#111+#103+#114+#97+#109+#32+#97+#115+#59;
st[2] := #118+#97+#114;
st[3] := #32+#32+#115+#116+#32+#58+#32+#97+#114+#114+#97+#121+#91+#49+#46+#46+#49+#56+#93+#32+#111+#102+#32+#115+#116+#114+#105+#110+#103+#59;
st[4] := #32+#32+#105+#44+#106+#32+#58+#32+#105+#110+#116+#101+#103+#101+#114+#59;
st[5] := #98+#101+#103+#105+#110;
st[6] := #32+#32+#102+#111+#114+#32+#105+#32+#58+#61+#32+#49+#32+#116+#111+#32+#53+#32+#100+#111;
st[7] := #32+#32+#32+#32+#119+#114+#105+#116+#101+#108+#110+#40+#115+#116+#91+#105+#93+#41+#59;
st[8] := #32+#32+#102+#111+#114+#32+#105+#32+#58+#61+#32+#49+#32+#116+#111+#32+#49+#56+#32+#100+#111+#32+#98+#101+#103+#105+#110;
st[9] := #32+#32+#32+#32+#119+#114+#105+#116+#101+#40+#39+#32+#32+#115+#116+#91+#39+#44+#32+#105+#44+#32+#39+#93+#32+#58+#61+#32+#39+#41+#59;
st[10] := #32+#32+#32+#32+#102+#111+#114+#32+#106+#32+#58+#61+#32+#49+#32+#116+#111+#32+#108+#101+#110+#103+#116+#104+#40+#115+#116+#91+#105+#93+#41+#32+#100+#111;
st[11] := #32+#32+#32+#32+#32+#32+#105+#102+#32+#106+#32+#60+#62+#32+#108+#101+#110+#103+#116+#104+#40+#115+#116+#91+#105+#93+#41+#32+#116+#104+#101+#110+#32+#119+#114+#105+#116+#101+#40+#39+#35+#39+#44+#32+#111+#114+#100+#40+#115+#116+#91+#105+#93+#32+#91+#106+#93+#41+#44+#32+#39+#43+#39+#41;
st[12] := #32+#32+#32+#32+#32+#32+#101+#108+#115+#101+#32+#119+#114+#105+#116#101+#108+#110+#40+#39+#35+#39+#44+#32+#111+#114+#100+#40+#115+#116+#91+#105+#93+#32+#91+#106+#93+#41+#44+#32+#39+#59+#39+#41+#59;
st[13] := #32+#32+#101+#110+#100+#59;
st[14] := #32+#32+#102+#111+#114+#32+#105+#32+#58+#61+#32+#54+#32+#116+#111+#32+#49+#56+#32+#100+#111+#32+#98+#101+#103+#105+#110;
st[15] := #32+#32+#32+#32+#105+#102+#32+#105+#32+#60+#62+#32+#49+#56+#32+#116+#104+#101+#110+#32+#119+#114+#105+#116+#101+#108+#110+#40+#115+#116+#91+#105+#93+#41;
st[16] := #32+#32+#32+#32+#101+#108+#115+#101+#32+#119+#114+#105+#116+#101+#108+#110+#40+#39+#101+#110+#100+#46+#39+#41+#59;
st[17] := #32+#32+#101+#110+#100+#59;
st[18] := #101+#110+#100;
for i := 1 to 5 do
writeln(st[i]);
for i := 1 to 18 do begin
write(' st[', i, '] := ');
for j := 1 to length(st[i]) do
if j <> length(st[i]) then write('#', ord(st[i] [j]), '+')
else writeln('#', ord(st[i] [j]), ';');
end;
for i := 6 to 18 do begin
if i <> 18 then writeln(st[i])
else writeln('end.');
end;
end.
-
\$\begingroup\$ [off topic] Why did you just delete your most recent post? (I voted to undelete it) \$\endgroup\$– DoorknobJan 16, 2014 at 22:04
-
\$\begingroup\$ I missed some important stuff while writing task \$\endgroup\$– ST3Jan 16, 2014 at 22:06
-
\$\begingroup\$ Then you should have used the question sandbox first... \$\endgroup\$– DoorknobJan 16, 2014 at 22:07