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

1
\$\begingroup\$

MATLAB, Tom Carpenter, ≤16

v=ver;[v.Name]

Thanks Martin for helping me out with this.

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

Fishing, Eridan, ≤ 32

v+CCCCCCCCCCC
  `65617`nSSP

Calculates (65617^2)^2.

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

Octave, flawr, ≤4

i^-i

which is equal to eπ/2 ≈ 4.8105.

\$\endgroup\$
  • \$\begingroup\$ Dangit, you got it just before me! \$\endgroup\$ – Addison Crump Oct 11 '15 at 18:44
1
\$\begingroup\$

Groovy, quartata, ≤128

Only checked on ideone, I'm not sure if the output is the same on all platforms.

ClassLoader.systemClassLoader.packages.each{if(!(it.name=~/ls$/))println it.name[6..-1].reverse()}

The it.name=~/ls$/ is to filter out the additional org.codehaus.groovy.tools package.

\$\endgroup\$
  • \$\begingroup\$ Does not output the same on my system (Oracle Java 8, Groovy 2.4.5). Don't be fooled, this isn't what it looks like. \$\endgroup\$ – a spaghetto Oct 11 '15 at 18:23
  • \$\begingroup\$ Wait a second... I'm confused. I believe I might have posted the wrong string... \$\endgroup\$ – a spaghetto Oct 11 '15 at 18:25
  • \$\begingroup\$ Dammit. It appears that I posted the output of an older version of my program. I'm not sure what to do. \$\endgroup\$ – a spaghetto Oct 11 '15 at 18:27
  • \$\begingroup\$ @quartata I recommend correcting the output in your original post. kennytm, I recommend deleting this answer for now, trying to crack the corrected submission, and then undeleting it. Does that sound reasonable? \$\endgroup\$ – Alex A. Oct 11 '15 at 18:35
  • \$\begingroup\$ @quartata Updated with the new submission (still only tested on ideone, groovy 2.4). \$\endgroup\$ – kennytm Oct 11 '15 at 19:00
1
\$\begingroup\$

vim, Doorknob, 16

:redi@"|Ni!
pg?G
\$\endgroup\$
1
\$\begingroup\$

MATLAB, Tom Carpenter, ≤4

pi^i

It's not hard when the absolute value is 1.

\$\endgroup\$
  • \$\begingroup\$ Didn't think it would take long ;) \$\endgroup\$ – Tom Carpenter Oct 12 '15 at 2:52
1
\$\begingroup\$

Javascript, Ludovic Zenohate Lagoua, ≤64

var a="'";for(var b=11;b<2004;b+=4){a+=b;}a+="'";console.log(a);
\$\endgroup\$
1
\$\begingroup\$

Python 2.7.2, Beta Decay, ≤ 64

import math,re;print zip(dir(math),dir(re))

I had 2.7.10 installed, and the additional __loader__ messed with the results, but this is probably it (I had to confirm with @BetaDecay in chat).

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

STATA, bmarks, ≤32 bytes

set ob 82
g a=_n*9/8
set ob 99
l

This uses the free interpreter.

\$\endgroup\$
  • \$\begingroup\$ This doesn't match the .s in lines 83 and after. \$\endgroup\$ – bmarks Oct 12 '15 at 1:36
  • \$\begingroup\$ @bmarks Also, are you completely sure (including newlines) that the program is less than ≤ 32 bytes long? \$\endgroup\$ – LegionMammal978 Oct 12 '15 at 10:25
  • \$\begingroup\$ The program (including newlines) is definitely ≤ 32 bytes long according to mothereff.in/byte-counter \$\endgroup\$ – bmarks Oct 12 '15 at 20:18
  • \$\begingroup\$ @bmarks I fixed it \$\endgroup\$ – LegionMammal978 Oct 13 '15 at 12:12
1
\$\begingroup\$

Brainfuck, Daniel M., ≤ 64

++++++++++[->++++>++++++>++++++++>+<<<<]>.>>.<.>>++[-<++.>]

The code points are

[40, 80, 60, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104]

So we print the first three separately, then using the 80 to increment by 2 each time for the rest of the chars.

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

Python 2, <=8, by Clear question with examples

947**687

Factorizing this number took no time at all :-)

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

Hassium (in REPL), <=32 bytes, by Jacob Misirian

for(i=0;i<99;i++)print(i%6==0)

Not too much fancy in this one.

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

AppleScript, VTCAKAVSMoACE, ≤32 bytes

repeat 409 times
log "(**)"
end

The log command actually adds comment markers (*...*) to everything it outputs to the Messages window of the script editor, but it looks like they have to be added explicitly when printing to stdout. Either way, the program is still less than 32 characters.

I'm using Digital Trauma's trick of replacing end repeat with end to save a few bytes.


EDIT: As kennytm correctly pointed out, this outputs to stderr instead of stdout. As a workaround, I can suggest the following:

osascript -e 'repeat 409
log "(**)"
end' 2>&1

Including line breaks, the script inside the single quotes is 25 bytes, Add 5 bytes for 2>&1 at the end of the command line to redirect stderr to stdout, and it's still within the 32 byte limit.

\$\endgroup\$
  • \$\begingroup\$ Heh, nice one. I used Script Editor, so it did not require the end repeat with end trick. +1 \$\endgroup\$ – Addison Crump Oct 13 '15 at 8:57
  • 1
    \$\begingroup\$ The times is optional. However, on El Capitan it outputs to stderr. \$\endgroup\$ – kennytm Oct 13 '15 at 9:57
1
\$\begingroup\$

Javascript, RononDex, ≤ 32 bytes

console.log(Math.log(42))

Very easy :-D

\$\endgroup\$
  • 2
    \$\begingroup\$ That wonderful inverse calculator :) \$\endgroup\$ – J Atkin Oct 13 '15 at 15:31
1
\$\begingroup\$

Thue, histocrat, ≤64

a::=yellowyellowyellowredyellowred
::=
aaaaaa
\$\endgroup\$
1
\$\begingroup\$

><>, Fongoid, ≤ 16

'$1-:0(?;$:o3+ !

That was some nice golfing practice.

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

AppleScript, VTCAKAVSMoACE, ≤ 2 Bytes

id

I have no idea why this produces the output missing value; I just wrote a bash script to test all pairs of printable ASCII characters. I also found that it and me result in the output «script».

\$\endgroup\$
  • \$\begingroup\$ Gah. Brute forcing. But yes, that's correct. I was originally going to do a it, me, or, in fact, name code, but « wasn't ASCII. The reason why it outputs "missing value" is that id will (almost) never throw a syntax error, but executing it on its own without a following value will cause the script, not the compiler to say that it's missing a value. id would typically be used with, say, window id 283 of app "TextEdit" to select that specific window. +1, but sad that you brute forced it. \$\endgroup\$ – Addison Crump Oct 16 '15 at 12:14
1
\$\begingroup\$

MATLAB, Tom Carpenter, ≤ 2

!<

Thanks to @AlexA. and @RetoKoradi for helping me test this. I don't have a Windows PC/VM...

Googling the desired output immediately revealed it as a typical Windows Cmd error. In fact,

<

produces the desired output, and a MATLAB command that is prefixed by a ! is a system command. I don't have MATLAB at hand to test this, but it should work.

\$\endgroup\$
  • \$\begingroup\$ Yup. Thought that one would be quite difficult, but never mind. I'd actually used !> but both do the same thing. \$\endgroup\$ – Tom Carpenter Oct 17 '15 at 14:29
  • \$\begingroup\$ Google is your foe here. Searching for the error message immediately revealed it as a typical Cmd error. \$\endgroup\$ – Dennis Oct 17 '15 at 14:38
1
\$\begingroup\$

><>, quartata, ≤ 32

1"qq"+\
v!?:  <$*d$-1
>~n;

I'd like to thank @quartata for make this interesting - despite being such a long number, it's actually just 13^226.

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

><>, Fongoid, ≤64 Bytes

"!":"~"=a$.1+:"!"(?;::1-$oo20.
"+"f8+0pa0.2-"-"c0p"3"f7+0p

A little bit hard-coded since I had room and I couldn't really think of a good way to go down once I got to ~ in the output (there probably is one and I probably just don't see it).

You can try it online here.

\$\endgroup\$
  • \$\begingroup\$ That self-modifying code is pretty slick! \$\endgroup\$ – DLosc Oct 19 '15 at 16:19
1
\$\begingroup\$

Pip, DLosc, ≤ 2

O_

I don't really understand what the code does, but 2 characters is wide open to brute force cracking.

\$\endgroup\$
  • \$\begingroup\$ I've added an explanation to the original post. \$\endgroup\$ – DLosc Oct 19 '15 at 16:12
1
\$\begingroup\$

Wolfram programming language, Eridan, ≤32

ContinuedFraction[Zeta[3],36]

It's sequence A013631 on OEIS.

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

AppleScript, VTCAKAVSMoACE, ≤64

osascript -e 'repeat with i from 688 to 195049 by 629
log i mod 1e3
end' 2>&1

Needs a redirect to stdout, similar to https://codegolf.stackexchange.com/a/60601/32353. Total size is 64.

\$\endgroup\$
  • \$\begingroup\$ No, this is not correct - I do print to STDOUT. \$\endgroup\$ – Addison Crump Oct 16 '15 at 15:46
  • \$\begingroup\$ @VTCAKAVSMoACE: Okay. \$\endgroup\$ – kennytm Oct 16 '15 at 18:27
1
\$\begingroup\$

Lua, jcgoble3, ≤ 128

x=111111111
h="haha"
p=h..3*x..2*x..h..7*x..h..2*x
q="ha"..6*x..p..p..h..6*x..h..7*x..h..4*x..h..5*x
"ha"..(q..h):rep(11)..q

124 bytes. Tested in Lua 5.3.1 REPL.

This is a cleaner version that can be executed as a single command or even a full program:

x=111111111 h="haha" p=h..3*x..2*x..h..7*x..h..2*x q=h..6*x..p..p..h..6*x..h..7*x..h..4*x..h..5*x print((q.."ha"):rep(11)..q)

125 bytes. Tested in Lua 5.3.1 REPL and ideone.

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

Pyth, ConfusedMr_C, ≤ 32

sm*2s_c4s_Mcd2%2_c4sCM127

Only needed 25 chars. Took some while though.

Try it online: Demonstration

The idea is to take all chars of the ranges 32-63 und 96-126 (Yes, 127 is not included), rearrange them, duplicate these strings and join them.

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

Self-modifying Brainfuck, mbomb007, ≤8

<[-.+<]

stdin needs to be /dev/null and disregard the output from stderr.

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

QBasic, DLosc, ≤16

?STRING$(3,34)
\$\endgroup\$
  • \$\begingroup\$ Aw, shoot. Not the solution I had in mind. Have a +1 anyway--I learned something. \$\endgroup\$ – DLosc Oct 22 '15 at 7:36
1
\$\begingroup\$

QBasic, DLosc, ≤8

?TAN(22)

Does the leading/trailing space thingy. I guess it's a QBasic quirk.

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

CJam, Eridan, ≤8

6C#E130#

I assumed it would be a list of numbers of the form i^j, so I did a search for those using substrings from output. I found that it was str(6 ** 12) + str(14 ** 130) using a Python script.

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

Python 3, ppperry, ≤32

0x1d4f620cb7a9ca2c585c639763613
\$\endgroup\$
  • \$\begingroup\$ That was not what I had in mind. \$\endgroup\$ – pppery Oct 24 '15 at 19:26

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.