26
\$\begingroup\$

The cops thread can be found here: The Mystery String Printer (Cops)

Your challenge

  • Choose a submission from the cops thread, and print out the string from an answer in that thread.
  • The submission that you choose must not be safe (it must be newer than 7 days).
  • Your program, function, or REPL script needs to follow the same rules as the cops thread. Just to recap:

    • Your program must be ≤128 characters (if a cop's submission is in a smaller range of program lengths, your program must also be in that length range. For example, if a cop's program is ≤32 bytes, your program must be ≤32 bytes).
    • The program must produce the same output every time it is run.
    • No cryptographic functions.
    • The program must not take input.
    • No standard loopholes.
  • All new submissions must use the same language. Submissions from before this rule was made are fine, even if they don't.

Scoring

Scoring works similarly for robbers, but it is slightly different:

  • Cracking any program of ≤8 bytes gives 1 point.
  • Cracking a ≤16 byte program gives 2 points. ≤32 bytes gives 4 points, and so on.
  • Every additional submission, no matter the length, earns +5 points
  • Each cop's submission can only be cracked once- only the first person to crack each submission gets the points.

Submissions

Each answer must include

  • A link to the cop's submission.
  • Your program and programming language.
  • Also have the cop's program length (as a power of 2) as the last number in your header.

Additionally, please comment on the cop's submission with a link to your answer.

Here is a Stack Snippet to generate leaderboards. Please leave a comment if there is a problem with the snippet. If you would like to see all open cop submissions, see the snippet in the cops' challenge.

/* Configuration */

var QUESTION_ID = 60329; // Obtain this from the url
// It will be like http://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";

/* App */

var answers = [],
  answers_hash, answer_ids, answer_page = 1,
  more_answers = true,
  comment_page;

function answersUrl(index) {
  return "//api.stackexchange.com/2.2/questions/" + QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}

function commentUrl(index, answers) {
  return "//api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}

function getAnswers() {

  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function(data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });

}

function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function(data) {
      data.items.forEach(function(c) {

        answers_hash[c.post_id].comments.push(c);

      });

      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });
}

getAnswers();

var POINTS_REG = /(?:<=|≤|&lt;=)\s?(?:<\/?strong>)?\s?(\d+)/
var POINTS_REG_ALT = /<h\d>.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;


function getAuthorName(a) {
  return a.owner.display_name;
}

function process() {

  var valid = [];
  var open = [];

  answers.forEach(function(a) {

    var body = a.body;
    var cracked = false;

    var points = body.match(POINTS_REG);
    if (!points) points = body.match(POINTS_REG_ALT);

    if (points) {
      var length = parseInt(points[1]);
      var crackedpoints = 0;
      if (length > 64) crackedpoints = 16;
      else if (length > 32) crackedpoints = 8;
      else if (length > 16) crackedpoints = 4;
      else if (length > 8) crackedpoints = 2;
      else crackedpoints = 1;

      valid.push({
        user: getAuthorName(a),
        numberOfSubmissions: 1,
        points: crackedpoints

      });
    }
  });

  var pointTotals = [];
  valid.forEach(function(a) {

    var index = -1;
    var author = a.user;
    pointTotals.forEach(function(p) {
      if (p.user == author) index = pointTotals.indexOf(p);
    });

    if (index == -1) pointTotals.push(a);
    else {
      pointTotals[index].points += a.points;
      pointTotals[index].numberOfSubmissions++;
    }

  });

  pointTotals.forEach(function(a) {
    a.points += +((a.numberOfSubmissions - 1) * 5);
  });

  pointTotals.sort(function(a, b) {
    var aB = a.points,
      bB = b.points;
    return (bB - aB != 0) ? bB - aB : b.numberOfSubmissions - a.numberOfSubmissions;
  });

  pointTotals.forEach(function(a) {


    var answer = jQuery("#answer-template").html();
    answer = answer
      .replace("{{NAME}}", a.user)
      .replace("{{SUBMISSIONS}}", a.numberOfSubmissions)
      .replace("{{POINTS}}", a.points);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);


  });

}
body {
  text-align: left !important
}
#answer-list {
  padding: 20px;
  width: 240px;
  float: left;
}
#open-list {
  padding: 20px;
  width: 450px;
  float: left;
}
table thead {
  font-weight: bold;
  vertical-align: top;
}
table td {
  padding: 5px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">
<div id="answer-list">
  <h2>Robber's Leaderboard</h2>
  <table class="answer-list">
    <thead>
      <tr>

        <td>Author</td>
        <td>Submissions</td>
        <td>Score</td>
      </tr>
    </thead>
    <tbody id="answers">

    </tbody>
  </table>
</div>

<table style="display: none">
  <tbody id="answer-template">
    <tr>
      <td>{{NAME}}</td>
      <td>{{SUBMISSIONS}}</td>
      <td>{{POINTS}}</td>
    </tr>
  </tbody>
</table>

This contest is now closed.

Overall winner: kennytm

Most submissions: Sp3000

(Note that the amount of submissions doesn't translate exactly to the points, as the length of the cracked program is counted when calculating the score).

\$\endgroup\$
  • \$\begingroup\$ Note: every additional submission earns 5 points \$\endgroup\$ – Daniel M. Oct 12 '15 at 20:13

93 Answers 93

3
\$\begingroup\$

CoffeeScript, J Atkin, ≤ 16

Math.PI*Math.LN2

Hooray for the inverse symbolic calculator.

\$\endgroup\$
  • \$\begingroup\$ Well, that was fast. \$\endgroup\$ – lirtosiast Oct 13 '15 at 2:40
  • \$\begingroup\$ Ok, that was lame of me to try that ;) \$\endgroup\$ – J Atkin Oct 13 '15 at 2:55
3
\$\begingroup\$

PARI/GP, alephalpha, ≤ 4

9!-9

I don't actually know the language, but that has to be the right answer.

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

TI-BASIC, quartata, ≤2

Xmin

On a fresh calculator, the window dimensions are Xmin=Ymin= -10, Xmax=Ymax=10. I actually posted about this in a TI-BASIC golfing tip answer before @quartata posted the cop!

Current consensus is to allow all code to be run on a fresh interpreter. We can take advantage of this—all uninitialized real variables start at 0 in TI-BASIC, and Xmin starts as the possibly useful value -10. So if you ever need to take a running total in a program that doesn't take input from Ans, or you really need a -10 in one less byte, this tip can help you.

There are therefore four solutions: Xmin, Ymin, ZXmin, and ZYmin—the latter are the zoom tokens, which I don't know the exact purpose of.

\$\endgroup\$
  • \$\begingroup\$ I think the zoom tokens represent the screen location after zooming in on a graph... See here. \$\endgroup\$ – mbomb007 Oct 16 '15 at 15:19
3
\$\begingroup\$

LOLCODE, sysreq, ≤ 4

OBTW

Found the intended solution here. :/

\$\endgroup\$
  • 3
    \$\begingroup\$ +1 for either research or reading every single post on this site, not sure which \$\endgroup\$ – lirtosiast Oct 17 '15 at 2:53
3
\$\begingroup\$

><> , randomra, ≤ 8

'ol(?;r>

For some reason, 23 was surprisingly hard to get.

\$\endgroup\$
  • 1
    \$\begingroup\$ Nice! My solution was 'l(?;o>x, with non-deterministic run and deterministic output. \$\endgroup\$ – randomra Oct 17 '15 at 10:24
3
\$\begingroup\$

TI-BASIC, Thomas Kwa, ≤ 4

³√(tanh(7°

I don't have any way to test the code, so I'm not completely sure if the notation is correct. The sequence of steps I used to get the output are:

  1. Value 7.
  2. Convert from degrees to radians.
  3. Apply hyperbolic tangent.
  4. Apply cube root.

Cracking method:

  • I made the assumption that the 4 bytes were one single byte constant, with 3 operators listed as "1 byte token" in the documentation applied to it.
  • For the constants, I used the 10 single digit numbers, and pi, giving 11 options.
  • For the operators, I picked the ones from the list of one byte tokens that looked like they would make sense in this context, resulting in a list of 26 operators.

This left me with brute forcing 11 * 26 * 26 * 26 possibilities, which a small C++ program completed in milliseconds on my laptop. Listing the smallest differences to the target value, it gave a bunch in the range of 1e-5, and a single one that was about 6e-8, which was close enough to be a solution.

\$\endgroup\$
  • 1
    \$\begingroup\$ Something like ʳ? \$\endgroup\$ – Dennis Oct 17 '15 at 20:40
  • \$\begingroup\$ @ThomasKwa I multiplied by (pi/180). Reading the documentation again, I guess it makes sense that it would be the other operator. Because that one says "you can have the angle evaluated as if in degree mode". \$\endgroup\$ – Reto Koradi Oct 17 '15 at 20:47
  • \$\begingroup\$ Did you brute-force, or solve this manually? \$\endgroup\$ – lirtosiast Oct 17 '15 at 20:51
  • \$\begingroup\$ @ThomasKwa I mostly let my computer solve it. ;) I'll add some explanation. \$\endgroup\$ – Reto Koradi Oct 17 '15 at 20:52
3
\$\begingroup\$

gs2, quartata, Range: <= 8

\x01\x02\x01\x07/e\x81e

The number is simply 2^5040 (i.e., 2 raised to the power of 7 factorial). Factorizing it was the easy part. Finding out how to work gs2 took a lot longer.

The workings of the program are described below (using \xNN notation to represent non-ASCII bytes):

\x01\x02                   Push the number 2 onto the stack
        \x01\x07           Push the number 7 onto the stack
                /          Change this into a list [1,2,3,4,5,6,7]
                 e         Multiply everything in this list (5040)
                  \x81     Make a list containing [2,2,2...] 5040 times
                      e    Multiply everything together again

This leaves the number 27! on the stack, which is printed when the program exits.

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

AppleScript, VTCAKAVSMoACE, ≤16

{1=1,1=0}>0

Needs 5 more bytes to redirect to stdout, so total size is exactly 16 bytes.

\$\endgroup\$
  • \$\begingroup\$ Well done! :D I was mildly hopeful that no one would recognize that the > character would throw that specific error, and try to use as integer or the like. \$\endgroup\$ – Addison Crump Oct 18 '15 at 17:32
3
\$\begingroup\$

JavaScript, histocrat, ≤ 32

Well, this was lucky. I needed exactly 32 bytes:

[...'aa0abaabaa4abaaaa6abaa']+''

How this works:

  • the brand new spread-operator* creates an array from a string
  • + '' forces the array to be casted to string, which implies a concatenation by , in JavaScript
  • the result of the expression is printed onto the console

So basically it's a shorter version of:

'aa0abaabaa4abaaaa6abaa'.split('').join()

* The spread-operator is a new Array Initializer in ECMAScript 2015 (ES6) standard. Works currently in Chrome and Firefox.

\$\endgroup\$
  • 1
    \$\begingroup\$ Ha, had no idea javascript had a splat now. \$\endgroup\$ – histocrat Oct 19 '15 at 13:10
2
\$\begingroup\$

TI-BASIC, quartata, <=7

πE8/e

I found this using RIES.

\$\endgroup\$
  • 1
    \$\begingroup\$ It seems like REIS will prevent most simple math ops, which I can't say is such a bad thing. \$\endgroup\$ – Daniel M. Oct 11 '15 at 4:04
  • \$\begingroup\$ Did not know about RIES. Definitely won't be doing any number ones then :P \$\endgroup\$ – a spaghetto Oct 11 '15 at 4:14
2
\$\begingroup\$

Math++, SuperJedi224, ≤8 bytes

cbrt7835

I used the Inverse Symbolic Calculator.

\$\endgroup\$
  • \$\begingroup\$ Yeah, that's right. \$\endgroup\$ – SuperJedi224 Oct 11 '15 at 16:41
2
\$\begingroup\$

Python, Status, ≤128 bytes

print"NEENER"*3# This code outputs the following string: "NEENERNEENERNEENER". This is achieved by evaluating "NEENER" * 3.
\$\endgroup\$
2
\$\begingroup\$

Microscript, SuperJedi224, ≤4 bytes

'~$q

It took me a while to find the ' instruction...

\$\endgroup\$
2
\$\begingroup\$

bc -l, NaN, <=8

l(4.76)

Derived from a rather longer solution found using ISC.

\$\endgroup\$
2
\$\begingroup\$

TI-89 BASIC, @DankMemes, <=8

236!

The string of zeroes at the end gave it away.

\$\endgroup\$
2
\$\begingroup\$

Python, Zach Gates, ≤ 64

s='UCAG'
print(" ".join(x+y+z for x in s for y in s for z in s))

Behold the ton of other attempts:

# Python 3 only
from itertools import*
print(*map("".join,product(*["UCAG"]*3)))

# Python 2 only
def f(s):
 if s[2:]:print s,
 else:for x in"UCAG":f(s+x)
f("")

# Too long
o=""
for n in range(64):exec("o+='UCAG'[n%4];n//=4;"*3);o+=" "
print(o)

# Too long
L=[""]
exec("L=[x+y for x in L for y in'UCAG'];"*3)
print(" ".join(L))
\$\endgroup\$
2
\$\begingroup\$

><>, Cole, ≤ 8

'l?!;}n!

Pretty obvious when the code points in the output give basically all the chars.

\$\endgroup\$
  • \$\begingroup\$ Didn't have time to comment on this earlier but I'm still pretty impressed at how fast you got that. I wasn't sure if errors were allowed, but I considered putting * in stead of }; would that have been any harder? Ah well, guess I'll have to take a look at your submission. \$\endgroup\$ – cole Oct 13 '15 at 2:15
  • \$\begingroup\$ @Cole * would indeed have been harder, but I'm not sure about the error thing either... \$\endgroup\$ – Sp3000 Oct 13 '15 at 2:20
2
\$\begingroup\$

PowerShell, TimmyD, ≤2

$?

I looked at this page of commands and found two that seemed like they would print true.

\$\endgroup\$
2
\$\begingroup\$

Javascript ES6 REPL, pandorym, ≤16

6496/9090+"323"
\$\endgroup\$
2
\$\begingroup\$

QBasic, DLosc, <=32

FOR c=1TO 8
?TAB(c*c);c;
NEXT

The answer was so trivial, it was converted to a comment.

TAB can be used in a PRINT (shortcut ?) statement to set the cursor position.

\$\endgroup\$
  • \$\begingroup\$ Looks good now! (Also, not my original code, by the way--in fact, yours is 2 bytes shorter.) \$\endgroup\$ – DLosc Oct 13 '15 at 20:49
2
\$\begingroup\$

JavaScript, Cᴏɴᴏʀ O'Bʀɪᴇɴ, ≤16 bytes

You could just enter the number in hexadecimal at the console like this:

0x6ffffffffffffe

This is one byte shorter:

s=1<<26;s*s*7-2

(In other languages, (7<<52)-2 would have worked fine, but not Javascript.)

\$\endgroup\$
  • \$\begingroup\$ Not the exact same one I had in mind. \$\endgroup\$ – Conor O'Brien Oct 14 '15 at 1:41
  • \$\begingroup\$ @CᴏɴᴏʀO'Bʀɪᴇɴ but he produced the string. Was it 7*Math.pow(2,52)? \$\endgroup\$ – Sven Writes Code Oct 14 '15 at 13:08
2
\$\begingroup\$

Javascript, user2428118, <= 16

Math.PI*9e9

Thanks to Sven the Surfer for the help.

I used ISC which was used to crack one of my answers.

\$\endgroup\$
2
\$\begingroup\$

VBA, JimmyJazzx, ≤32

Sub a()
MsgBox -2^31+23
End Sub

I think; I can't actually get it to stay like this since the VBA editor reformats and adds spaces between the math operators ... but typing that in works and doesn't error...

\$\endgroup\$
  • \$\begingroup\$ Yep. Not exactly what I had, But works just as well. VBA editor is a pain for spaces.And for most of the golfing counts its acceptable to remove unnecessary spaces from VBA. as long as when you copy paste it works. Good job! knew someone would out math me quite quickly, but with 10 bytes to play with your limited \$\endgroup\$ – JimmyJazzx Oct 15 '15 at 11:30
2
\$\begingroup\$

Lua, Egor Skriptunoff, ≤ 32

_='()()()'print(_:gsub(_,_.rep))
\$\endgroup\$
  • 2
    \$\begingroup\$ Welcome to PPCG! You should also ensure to add a comment on Egor's answer linking back to this post, so that Egor is aware you potentially cracked the solution. \$\endgroup\$ – AdmBorkBork Oct 15 '15 at 13:03
2
\$\begingroup\$

CJam, Dennis, ≤ 4

P2mh

Glorious inverse symboli... shot

\$\endgroup\$
  • \$\begingroup\$ It was also the only Google search result, but I was too slow trying to figure out how to CJam. Well done. \$\endgroup\$ – Sven Writes Code Oct 17 '15 at 23:59
2
\$\begingroup\$

Pip, DLosc, ≤ 4

mTB3

The value is 1000 in base 3.

This one was easy to crack manually. The most obvious guess was that it was a number converted to binary. But that number would have been 105, which has no nice shortcut, and would result in 5 bytes of code. The next attempt was to try base 3 instead of base 2, and bingo!

\$\endgroup\$
2
\$\begingroup\$

Javascript (ES6, console), Shaun H, <= 64

[...[].pop+''].sort().map(x=>x.charCodeAt()+'').join('')

At first I thought I could get the Chrome string short enough with just hex literals, but then I realized what the code must have been doing.

Anyway, the main hint was that native functions have slightly different string representations in Chrome vs FF.

\$\endgroup\$
2
\$\begingroup\$

J, Mauris, <=4

%!7

This wasn't difficult. 0.000198413 = 1/5040 = 1/(7!)

\$\endgroup\$
2
\$\begingroup\$

J, Dennis, <=4

8!^5

How I found it:

  • assumed f ? ? ? format and inverted one-variable one-letter verbs (f) with no success
  • assumed x f g y format and checked fg == !! with (!!)"0/~i.10 then fg == !^ with (!^)"0/~i.10 which contained the desired output (4.81845e12) for 8!^5
\$\endgroup\$
1
\$\begingroup\$

Mathematica, Eridan, ≤64

IntegerString[18612512719586442658197,2]
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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