Quine Anagrams! (Robbers' Thread)

8

1

This is the robbers' thread. For the cops' thread, click here.

Cops' Task

For the cops' thread, click here.

Robbers' Task

  • Find an uncracked submission on the cops' thread. (A submission may only be cracked once.)
  • Unscramble the code to find a working quine.
  • Post an answer on the robbers' thread. Include the language, the byte count, the user who posted the scrambled code, a link to that answer, and the unscrambled code.

Here is an example of a robber submission:

Python, 29 bytes, Oliver

_='_=%r;print _%%_';print _%_

Scoring

The user with the most cracks will be the winner of this section.

Oliver Ni

Posted 2016-11-11T17:46:17.303

Reputation: 9 650

1What is up with the link?! – Solomon Ucko – 2016-11-11T21:33:47.577

Answers

6

Vim, 22 bytes, Loojvo

qtiqtqx0l"tp^V^[^[qx0l"tp

Try it online!

Explanation:

qt                  " Start recording in register 'q'
  i                 " Enter insert mode
   qtqx0l"tp        " Enter this string
            ^V^[    " Enter a literal 'esc' character
                ^[  " Exit insert mode
                  q " Stop recording

At this point, the buffer looks like this:

qtqx0l"tp^[

And the cursor is on the last column (the 'esc' key).

x                   " Delete the esc character
 0l                 " Move to the second character on this line
   "tp              " And paste register 't'

James

Posted 2016-11-11T17:46:17.303

Reputation: 54 537

6

Underload, 20 bytes, ais523

(:a~*(*S)):a~*(*S)*S

Try it online!

Explanation

The basic quine in Underload is this:

(:aSS):aSS

Here is how it works:

                                  Stack:               Output:
(:aSS)      # Push string.        (:aSS)
      :     # Duplicate.          (:aSS) (:aSS)
       a    # Wrap in (...).      (:aSS) ((:aSS))
        S   # Print.              (:aSS)               (:aSS)
         S  # Print.                                   (:aSS):aSS

The first issue was to reduce the number of S we need, because we've only got 3 for use here. We can do this by making use of swapping (~) and concatenation (*):

(:a~*S):a~*S

Here, instead of printing twice, we put the (...) version and the plain version of the string together and print that only once.

The bigger puzzle is how print an odd number of * and S. I'm not even sure how I actually arrived at the final solution, but it turns out that we can do this by putting the tail of the output in a separate string. That string itself is duplicated in the first string, but the contents are not, which gives us the extra occurrences of * and S we need. Here is a breakdown of the final solution:

                        Stack:                       Output:
(:a~*(*S))              (:a~*(*S))              
          :             (:a~*(*S)) (:a~*(*S))              
           a            (:a~*(*S)) ((:a~*(*S)))
            ~           ((:a~*(*S))) (:a~*(*S))
             *          ((:a~*(*S)):a~*(*S))
              (*S)      ((:a~*(*S)):a~*(*S)) (*S)
                  *     ((:a~*(*S)):a~*(*S)*S)
                   S                                 (:a~*(*S)):a~*(*S)*S

Martin Ender

Posted 2016-11-11T17:46:17.303

Reputation: 184 808

6

MATL, 20 bytes, Luis Mendo

'wo&GzL0fk'tl#DwI-ch

Try it online!

I've never used MATL before, so my understanding may be slightly off, but this is basically how it works:

'wo&GzL0fk' This is a string representation of the code, offset by 3
t           Creates a duplicate copy of the string
l#D         Adds quotes to the second copy
w           Swap the unquoted version to the top of the stack
I-          Offset the characters in that version by 3
c           Convert back to characters
h           Join with the quoted string

James Holderness

Posted 2016-11-11T17:46:17.303

Reputation: 8 298

Impressive! Especially considering this is your first Matlab answer. Well done! – Luis Mendo – 2016-11-13T23:18:12.780

4

Retina, 20 bytes, Martin Ender


\)1S*`\(?
\)1S*`\(?

Try it online

I found this simply by messing around attempting to create a quine. I found the "shorter quine" that he hinted at first (or a similar one, at least), simply by experimenting (14 bytes):


\)1S*`
\)1S*`

Try it online

It took me about half an hour to an hour. Very clever, Martin!

mbomb007

Posted 2016-11-11T17:46:17.303

Reputation: 21 944

Nice job! :) There are about 6 variants of the 14-byte quine, I think. – Martin Ender – 2016-11-16T16:40:37.640

@MartinEnder I started by trying to shuffle your anagram around, but that wasn't helping, so I started with the known quine and modified that. – mbomb007 – 2016-11-16T16:42:11.567

@MartinEnder Did you add the new quine to the "Golf you a quine" question? – mbomb007 – 2016-11-20T21:09:31.833

Yes. – Martin Ender – 2016-11-20T21:19:17.730

4

Python 2, 54 bytes, Loojvo

l= ['l=', ';print l[0],`l`,l[1]'] ;print l[0],`l`,l[1]

Had a hard time finding it, as I have basically almost never touched python

FliiFe

Posted 2016-11-11T17:46:17.303

Reputation: 543

3

JavaScript ES6, 49 bytes, Mama Fun Roll

function f(){return    `${(((((k=>f+'')(f)))))}`}

Pretty much the standard JS function quine, with a little obfuscation.

ETHproductions

Posted 2016-11-11T17:46:17.303

Reputation: 47 880

3

><>, 36 bytes, Erik the Golfer

'''000**rd3*:::?!;od0.!!+..233??dfrr

Try it online!

I'm quite sure that this is not the intended solution. However, ><> quines make it fairly easy to get rid of most unwanted characters, except the '. Fortunately, the : made it quite easy to take care of those as well.

Explanation

'''                                    Push everything except these quotes onto the stack.
   000**                               In effect, pushes a zero.
        r                              Reverse the stack.
         d3*                           Push 39 (the quote character).
            ::                         Make two copies. The stack now holds
                                       a null-terminated representation of the
                                       entire code.
                                       The print loop begins here...
              :                        Duplicate top of stack.
               ?!;                     Terminate if zero.
                  o                    Otherwise, print.
                   d0.                 Jump back to position 13, i.e. the
                                       beginning of the print loop.
                      !!+..233??dfrr   Unused characters.

Martin Ender

Posted 2016-11-11T17:46:17.303

Reputation: 184 808

Yep, not the indended solution :P Well done. – Erik the Outgolfer – 2016-11-13T17:11:50.687

2

JavaScript, 147 bytes, jrich

+function e(){window[(w=[``>``]+``)[i=9/9]+w[i+i]+"ert"]('+'+e+'()');"  +./;;;;;=======>[]````````ccddddddeeeeeeeefiinnnnoooooorrrrrrrsttuwwx{}"}()

With all those extra chars, this is definitely not the intended solution :-)

ETHproductions

Posted 2016-11-11T17:46:17.303

Reputation: 47 880

Yep, definitely not the intended solution, but I'm impressed! Good job! – jrich – 2016-11-12T20:07:25.670

@jrich The trickiest part was figuring out how to balance the brackets and parens so that I wasn't using any extra ones. I see you didn't realize that the (false+"")[1] trick would be useful here? ;) – ETHproductions – 2016-11-12T20:11:24.913

Didn't think about it to be honest... my solution was... a little more difficult to say the least – jrich – 2016-11-12T20:13:46.907

2

Haskell, 86 bytes, Laikoni

y!r=r:y:r:[y]>>=id;main=putStr$[succ$'!']!"y!r=r:y:r:[y]>>=id;main=putStr$[succ$'!']!"

Nice idea to get the " via succ$'!' (ascii char after !). There were some missing chars to get them the usual way, i.e. implicitly via show or print.

nimi

Posted 2016-11-11T17:46:17.303

Reputation: 34 639

1

Befunge, 15 bytes, James Holderness

<:0:+1_@#%9,:g-

Try it online!

Explanation

The catch here is that the loop terminates when the current character is divisible by 9, which is only the case for -. Hence, that needs to go at the end.

<                 Run code from right to left.
              -   There will always be 2 zeros on top of the stack at this
                  point, and this just reduces them to 1 zero.
             g    Get the character at the coordinates given by the top
                  two stack values, (0, 0) initially.
           ,:     Print a copy of that character.
         %9       Modulo 9.
      _@#         Terminate if that is 0.
    +1            Increment the x coordinate.
   :              Duplicate it.
 :0               Push two zeros.

Martin Ender

Posted 2016-11-11T17:46:17.303

Reputation: 184 808

1

PHP, 110 bytes, Oliver

<?php $x='<?php $x=0; echo strtr($x, array(chr(39).$x.chr(39)));'; echo strtr($x, array(chr(39).$x.chr(39)));

Thanks, I had fun and the strtr([]) trick was a new one for me that I hope will save me some bytes in the future.

user59178

Posted 2016-11-11T17:46:17.303

Reputation: 1 007

0

Ruby, 53 bytes, wat

puts <<ENDIT*2,"ENDIT"
puts <<ENDIT*2,"ENDIT"
ENDIT

Just a modification of the standard heredoc quine:

puts <<2*2,2
puts <<2*2,2
2

Martin Ender

Posted 2016-11-11T17:46:17.303

Reputation: 184 808

0

Jelly, 3 bytes, Erik the Golfer

”ṘṘ

Try it online!

There aren't really that many options... (Plus, this is the standard quine.)

Martin Ender

Posted 2016-11-11T17:46:17.303

Reputation: 184 808

0

Python 2, 105 bytes, Erik the Golfer

a='a=%r;print a%%a ###(((())))**-01::@@@@@[[]]gggiiirrr~';print a%a ###(((())))**-01::@@@@@[[]]gggiiirrr~

It's just the standard Python string formatting quine...

Sp3000

Posted 2016-11-11T17:46:17.303

Reputation: 58 729