Quines:
What are they?
Quines, in short, are curious pieces of code that can write themselves back character for character.
For further reading check out: Wikipedia and this collection The Quine Page
Why should you care?
Because.
What does it look like?
Brace yourself. This is the compactest one I could find, at the time of writing, that works in Simba:
Simba Code:const a='const a=';b='begin writeln(a,#39,a,#39#59#98#61#39,b,#39#59#10,b) end.';
begin writeln(a,#39,a,#39#59#98#61#39,b,#39#59#10,b) end.Credit: Geoffrey A Swift (blimey@toke.com)
Note: I changed write() to writeln()
What is that?
It's a Quine! Let me break it down piece by piece so we can better understand how it works.
Even I at the time of writing this don't know what's exactly going on. Soon enough all shall be made clear.
Right from the start two constants are declared,
a:
and b:Simba Code:const a='const a=';
Simba Code:b='begin writeln(a,#39,a,#39#59#98#61#39,b,#39#59#10,b) end.';
"a" is the "initial" part of the script and "b" is the "body+end" of the script.
The "body+end" of the script is then actually executed on the next line with:
This outputs the constants a and b in the appropriate locations andSimba Code:begin writeln(a,#39,a,#39#59#98#61#39,b,#39#59#10,b) end.
any additional characters needed in between to recreate the script.
And let's not forget the important "end." to "finalize" the code.
For quick reference:
39 is '
59 is ;
98 is b
61 is =
10 is new line feed
Now what?
Well, I guess that's it. But nothing is stopping you from attempting to make it even shorter.
Or perhaps write your own! There are an infinite number of ways to make a Quine! Shortness isn't a requirement.
Some people make their Quines ridiculously complex just for the heck of it, sometimes even over several programming languages.
If you have one to share, post it below!

