# Shortest Mirror Quine Challenge [closed]

Find the shortest mirror quine in a language of your choice.

A mirror quine is a quine whose source code is equal to the reverse of its own source code.

Note:

1) Length of source code should be atleast 2.

2) Quines not allowed are the one whose text can be echoed directly.

Example: Let L' be any language, then a quine with source code like ABBA or ABCBA is a mirror quine.

## closed as unclear what you're asking by Mego♦, NoOneIsHere, Rɪᴋᴇʀ, pajonk, BlueJul 3 '16 at 10:10

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• Maybe you also want to exclude the form code+comment char+reverse code. – Howard Oct 18 '13 at 6:18
• @Howard yes, thanks for pointing this out.. – Coding man Oct 18 '13 at 6:32
• does ( mirror as (, or as ) (and similarly for other brackets)? If it's the former, then I think it disqualifies any potential solution. Even golfscripters need blocks. – John Dvorak Oct 18 '13 at 6:43
• @Howard what you suggest? or lets wait for atleast a single possible solution :P – Coding man Oct 18 '13 at 6:47
• The name "mirror quine" is confusing. It sounds like a program that outputs the reverse of its source (itself an interesting challenge perhaps). Yours is a palindromic quine. – Timwi Dec 16 '15 at 5:28

# HQ9+, 3 Characters

Am I cheating?

+Q+

• The right tool for the task. – Johannes Kuhn Oct 18 '13 at 15:27
• Finding an unexpected use for HQ9+ is always a good thing, so if it is a cheat, it's completely justified. – breadbox Oct 18 '13 at 16:17

## Perl, 53 characters

Perl's multifaceted text-handling features once again prove useful for golfing.

---BEGIN---

say$/.reverse$_=<<'';say
yas;''<<=_$esrever./$yas

----END----


Ignore the BEGIN and END markers; they're just there to keep the blank lines at the beginning and end from being suppressed from display. Yes, the source really does have two blank lines at the top and one blank line at the bottom. This apparent lack of symmetry may throw you at first, but that's just the nature of line breaks. What's really happening, of course, is that the source both begins and ends with two line break characters.

• wait, what? No parens? +1 from me – John Dvorak Oct 18 '13 at 18:28
• Why 2 line breaks at beginning and end? Why not 1? – Cruncher Dec 12 '13 at 18:04
• The concluding blank line closes the here-doc. – breadbox Dec 12 '13 at 19:17

# Golfscript, 33 characters

""~.{'""~.'print tnirp'.~""'}.~""


Since every language uses parentheses of some form, I assert the "( mirrors to (" version of this challenge is impossible (under rule #2), and assume ( mirrors to ). Additionally, this version provides more visual symmetry.

If trailing whitespace is allowed, empty strings can be replaced with newlines (29 characters):

n~.{'n~.'print tnirp'.~n'}.~n


Proceeds as follows:

• ""~. pushes an empty string onto the stack, evaluates it and clones the input (empty string)
• {...} is a block
• .~"" clones the block, evaluates one copy and pushes an empty string to the stack.

That block:

• '""~.' pushes the string ""~. onto the stack
• print outputs it directly and removes it from the stack
• tnirp is an undefined symbol and does nothing
• '.~""' pushes the string .~"" onto the stack

After the program finishes, the stack contents are printed:

• the empty string (twice)
• the main block, including delimiters
• the program suffix as a string
• another empty string

# Befunge 98 - 4035 31 or 29 characters

#r:0g,:a3*!e*j@j*e!*3a:,g0:r#


Saved another 4 characters, for 31 total, and complied with specs.

Or, if the other code can just be filler (29):

>:0g,:e2*!e*j@j*e!*2e:,g0:>


# Old Version

#r:0g,:'#3+ja+1r@r1+aj+3#':,g0:r#


Saved 5 characters by using ' to fetch the length of the program

#r:0g,:a4*3+jb+1r@  @r1+bj+3*4a:,g0:r#


Just a variation on a normal quine, but made into a palindrome.

:0g get the character at a location (counter, 0)
,   print it
:   take the counter
a4* get 10 * 4 (40, length of program)
   compare them (0 if counter is less or equal, 1 if greater)
3+  add 3
j   jump that amount (4 or 3)

if 4:
@   end program

if 3:
r   head the other way (to the left)
1+  increment counter
bj  jump 11 chars (to beginning r (reverse direction again))


# Mouse-2002, 73 bytes

2 0&FOPEN (x.74<^2&F?' !'x.1+x:)36!'~'!63):x+1.x'!'? F&2^<75.x( NEPOF&0 2
`