9
\$\begingroup\$

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.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ What is up with the link?! \$\endgroup\$ Nov 11, 2016 at 21:33

14 Answers 14

6
\$\begingroup\$

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'
\$\endgroup\$
6
\$\begingroup\$

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
\$\endgroup\$
6
\$\begingroup\$

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
\$\endgroup\$
1
  • \$\begingroup\$ Impressive! Especially considering this is your first Matlab answer. Well done! \$\endgroup\$
    – Luis Mendo
    Nov 13, 2016 at 23:18
4
\$\begingroup\$

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

\$\endgroup\$
4
\$\begingroup\$

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!

\$\endgroup\$
4
  • \$\begingroup\$ Nice job! :) There are about 6 variants of the 14-byte quine, I think. \$\endgroup\$ Nov 16, 2016 at 16:40
  • \$\begingroup\$ @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. \$\endgroup\$
    – mbomb007
    Nov 16, 2016 at 16:42
  • \$\begingroup\$ @MartinEnder Did you add the new quine to the "Golf you a quine" question? \$\endgroup\$
    – mbomb007
    Nov 20, 2016 at 21:09
  • \$\begingroup\$ Yes. \$\endgroup\$ Nov 20, 2016 at 21:19
3
\$\begingroup\$

JavaScript ES6, 49 bytes, Mama Fun Roll

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

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

\$\endgroup\$
0
3
\$\begingroup\$

><>, 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.
\$\endgroup\$
1
  • \$\begingroup\$ Yep, not the indended solution :P Well done. \$\endgroup\$ Nov 13, 2016 at 17:11
2
\$\begingroup\$

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 :-)

\$\endgroup\$
3
  • \$\begingroup\$ Yep, definitely not the intended solution, but I'm impressed! Good job! \$\endgroup\$
    – jrich
    Nov 12, 2016 at 20:07
  • \$\begingroup\$ @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? ;) \$\endgroup\$ Nov 12, 2016 at 20:11
  • \$\begingroup\$ Didn't think about it to be honest... my solution was... a little more difficult to say the least \$\endgroup\$
    – jrich
    Nov 12, 2016 at 20:13
2
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

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.
\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$
0
\$\begingroup\$

Jelly, 3 bytes, Erik the Golfer

”ṘṘ

Try it online!

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

\$\endgroup\$
0
\$\begingroup\$

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...

\$\endgroup\$
0
\$\begingroup\$

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
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.