31
\$\begingroup\$

This is the robber's thread of a challenge. You can view the cop's thread here

A pretty common beginner style question is to print some string, but, there's a catch!, you need to do it without using any of the characters in the string itself!

For this challenge we will find out who is the best at printing X without X. There are two threads to this, a cop's thread and a robber's thread.

In the cop's thread users will choose a language (which we will call Y) and a string (which we will call X) and write a program in language Y which takes no input and outputs X without using any of the characters in X. The cop will then post both X and Y without revealing the program they have written.

Robbers will be select cop answers and write programs in language Y which take no input and output X. They will post these "cracks" as answers in this thread. A crack need only work not be the intended solution.

Once a cop's answer is one week old, so long as it has not been cracked, the cop may reveal their program and mark it as "safe". Safe answers can no longer be cracked

Robbers will be scored by the total number of successful cracks with more cracks being better.

\$\endgroup\$
  • 1
    \$\begingroup\$ Congrats on an excellent challenge with high 'replay value'. I've had a lot of fun participating on both sides, digging into a couple of languages for the first time along the way. \$\endgroup\$ – Dingus Aug 20 at 3:22

84 Answers 84

4
\$\begingroup\$

PicoLisp, cracks @Wezl's answer

Yes, it was indeed simple! First time I heard about PicoLisp!

[prinl [char 40]][bye]

It seems to work on https://www.jdoodle.com/execute-picolisp-online/ with version 18.9.5.

PicoList output


I didn't knew ideone had PicoList prior to posting this, but, someone raised objections due to the output being : ( and not just (.

The : is the prompt for the tool used.
You can verify it in this ideone link: https://ideone.com/4vuYQL (it uses version 18.12.27).

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Yes! Exactly. I was hoping someone would try out picolisp. See if you can do it without spaces. (ideone.com doesn't need [bye] at the end, and prin works as well as prinl) \$\endgroup\$ – Wezl Jul 28 at 14:10
  • \$\begingroup\$ @Wezl I believe it is a lot better if you post the intended solution on codegolf.stackexchange.com/a/207691 (as per the definitions of the challenge, quoting: "A crack need only work not be the intended solution."). But it's good to see you confirming my solution as a working one. \$\endgroup\$ – Ismael Miguel Jul 28 at 19:02
  • \$\begingroup\$ The output is : (, not (. \$\endgroup\$ – Gilles 'SO- stop being evil' Jul 30 at 22:47
  • 2
    \$\begingroup\$ The output is (, the prompt is :. Check ideone.com/4vuYQL (I didn't knew before that ideone had Picolisp, which is why I didn't use it before). \$\endgroup\$ – Ismael Miguel Jul 31 at 13:17
  • \$\begingroup\$ On my machine and on jdoodle, the output is : (. I know that the : is meant as a prompt, but it's part of what the program prints to stdout. The ideone implemetation is a correct solution. \$\endgroup\$ – Gilles 'SO- stop being evil' Jul 31 at 16:54
4
\$\begingroup\$

Ruby, cracks Dingus's third answer

ZERO = $$ - $$
S_ZERO = String ZERO
ONE = -~ZERO
S_ONE = String ONE
S_TWO = String ONE + ONE
S_THREE = String ONE + ONE + ONE
S_FOUR = String ONE + ONE + ONE + ONE
S_FIVE = String ONE + ONE + ONE + ONE + ONE
S_SIX = String ONE + ONE + ONE + ONE + ONE + ONE
S_SEVEN = String ONE + ONE + ONE + ONE + ONE + ONE + ONE
S_EIGHT = String ONE + ONE + ONE + ONE + ONE + ONE + ONE + ONE
S_NINE = String ONE + ONE + ONE + ONE + ONE + ONE + ONE + ONE + ONE

S_TWO_POINT_ZERO = String Float ONE + ONE
S_TWO_POINT_ZERO =~ /#{Array Float ONE}/
DOT = $&

$alakazam_hrto_s = nil
$_ = String global_variables
$_ =~ /#{DOT}#{DOT}/
$& =~ /#{DOT}$/
COLON = $&
$_ =~ /#{DOT}#{DOT}#{COLON}/
$& =~ /#{DOT}#{DOT}$/
$& =~ /#{DOT}/
SPACE = $&
$_ =~ /alakazam_#{DOT}#{DOT}#{DOT}#{DOT}#{DOT}#{DOT}/
$_ = $&
$_ =~ /#{DOT}#{DOT}#{DOT}#{DOT}$/
S_to_s = $&
$_ =~ /#{DOT}#{DOT}#{DOT}#{DOT}#{DOT}#{DOT}$/
$& =~ /#{DOT}#{DOT}/
$_ = eval S_ONE + S_TWO + DOT + S_to_s + SPACE + S_ONE + S_SIX
DOT_CHR = DOT + $_ + $&

f_out = eval S_ONE + S_ONE + S_TWO + DOT_CHR
f_out += eval S_ONE + S_ONE + S_SEVEN + DOT_CHR
f_out += eval S_ONE + S_ONE + S_SIX + DOT_CHR
f_out += eval S_NINE + S_NINE + DOT_CHR
f_out += SPACE

eval f_out + S_NINE + S_NINE
eval f_out + S_ONE + S_ZERO + S_ZERO
eval f_out + S_ONE + S_ONE + S_TWO
eval f_out + S_FOUR + S_EIGHT
eval f_out + S_FOUR + S_NINE
eval f_out + S_FIVE + S_ZERO
eval f_out + S_FIVE + S_ONE
eval f_out + S_FIVE + S_TWO
eval f_out + S_FIVE + S_THREE
eval f_out + S_FIVE + S_FOUR
eval f_out + S_FIVE + S_FIVE
eval f_out + S_FIVE + S_SIX
eval f_out + S_FIVE + S_SEVEN
eval f_out + S_FOUR + S_SIX
eval f_out + S_NINE + S_SIX
eval f_out + S_THREE + S_NINE
eval f_out + S_THREE + S_FOUR
eval f_out + S_SIX + S_THREE
eval f_out + S_THREE + S_SEVEN
eval f_out + S_FOUR + S_ZERO
eval f_out + S_NINE + S_ONE
eval f_out + S_FIVE + S_EIGHT
eval f_out + S_SIX + S_ZERO

Try it online!

Looking at the character set, we can call eval and we have the + operator to concatenate strings. So if we can build arbitrary one-character strings, we're done. In Ruby, creating a character from its numeric code is 123.chr, but we don't have . or c.

I browsed through the list of global variables and predefined functions to see what interesting things I could use given the available characters.

We don't have digits, but since we have arithmetic operators, that's just a minor annoyance. We create variables containing each digit as a string, for later.

Our next objective is to have a way to extract a specific character from a string, without the […] subscript operator. Almost every interesting action on a string is a (non-operator) method call, which is impossible without .. We can do regexp matching. string =~ /./ puts the first character of the string in $&, and string =~ /.$/ puts the last character in $&, but we don't have .. Let's build ..

We can take a floating point number and convert it to a string with String. But we still don't know how to extract the . from that string. There's another way to match a single character in a regexp without simply listing this character, and that's character sets: can we somehow inject [something.somethingelse] into the regexp? Yes! We can inject the value of an expression (converted to a string) with /#{expression}/. And we can build a string surrounded by brackets by building an array, which is represented as [element, ...] as a string. Match "2.0" against /[1.0]/, and we get "." in $&. Now we can extract an arbitrary character from a string with one or two regexp matches (/#{DOT}…#{DOT}/ then /#{DOT}$/ to take the Nth character, or /#{DOT}…#{DOT}$/ then /#{DOT}/ to take the Nth character from the end).

Our next objective is to construct the string ".chr", after which we can construct arbitrary characters as e.g. eval "1" + "2" + "3" + ".chr". We can have hr in the source code but we need to inject them into a string, and we need to get chr from somewhere. A convenient way to inject letters into a string is global_variables, which converts to a string that looks like

[…, :$alakazam_hrto_s, …]

So define a global variable containing hr, add a unique pattern (alakazam_) to anchor it, and match /alakazam_../ against String global_variables. While we're at it, use regexp matching to get ":" and " ", and also "to_s". We can now evaluate "12.to_s 16" to get "c" (hexadecimal representation of 12).

Now that DOT_CHR is ".chr", assemble f_out = "putc", and print the desired characters one by one given their numeric code.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ This is really awesome, and much closer to what I had in mind. There are still some interesting differences though: I hadn't considered regexp interpolation and I knew I should have banned r! You also reminded me about $$, which makes banning digits redundant. So if you're not bored of this yet, I think I can make it even more rigid with a lower score. \$\endgroup\$ – Dingus Aug 1 at 1:27
4
\$\begingroup\$

Python 3.7, cracks water_ghosts's answer

import timeit,base64
class A:__class_getitem__=str.lower
class B:__class_getitem__=timeit.repeat
B[A["IMPORT SYS;PRINT('(NUVWXY');SYS.EXIT()"]]

Try it online

I set myself the additional challenge of golfing the solution. I tried a number of different approaches before settling on this one to minimize length; here are the ones that ended up working.

import timeit,base64
class A:__class_getitem__=base64.b32decode.__call__
class B:__class_getitem__=timeit.repeat
a=A["NFWXA33SOQQHG6LTBJYHE2LOOQUCOKDOOV3HO6DZE4UTW43ZOMXGK6DJOQUCS==="]
class C:__class_getitem__=a.decode.__call__
B[C["U8"]]
import timeit,base64
class A:__class_getitem__=chr
class B:__class_getitem__=timeit.repeat
B[A[105]+A[109]+A[112]+A[111]+A[114]+A[116]+A[32]+A[115]+A[121]+A[115]+A[10]+A[112]+A[114]+A[105]+A[110]+A[116]+A[40]+A[39]+A[40]+A[110]+A[117]+A[118]+A[119]+A[120]+A[121]+A[39]+A[41]+A[59]+A[115]+A[121]+A[115]+A[46]+A[101]+A[120]+A[105]+A[116]+A[40]+A[41]]
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Your top answer uses a w in str.lower, but the others work. Nice job! Let's see if I can make a new version that blocks the timeit library... \$\endgroup\$ – water_ghosts Aug 21 at 3:01
  • \$\begingroup\$ A simpler answer. \$\endgroup\$ – Razetime Aug 21 at 6:03
  • \$\begingroup\$ @water_ghosts I totally didn't notice the w in the first one, thanks for pointing that out \$\endgroup\$ – Ethan White Aug 21 at 15:35
4
\$\begingroup\$

Arn, 216 bytes, cracks @ZippyMagician's answer

one:3/3
two:(one+one)
four:(two+two)
five:(four+one)
six:(five+one)
seven:(six+one)
zero:(one-one)
[one five one two five one seven seven zero four one seven zero seven six four zero two zero zero zero zero zero]:|""

Try it!

Forming digits is easy enough since we still have access to 3, 8, and 9, as well as mathematical operations. We create an array containing the necessary digits and then join with the empty separator "" using the infix :|. Gotchas are (i) the surprisingly low precedence of + and - and (ii) the use of spaces (rather than commas) to separate array elements.

In the comments on the cop, @mypronounismonicareinstate suggested 9/9+9/9+9/9+9/9+... as a possible crack. This approach works in theory but not in the online interpreter, which switches over to scientific notation once the sum reaches 1e21.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Nice job! If I ever do another one I’ve got to remember to print all of the digits so it isn’t so easy :) \$\endgroup\$ – ZippyMagician Aug 28 at 18:47
3
\$\begingroup\$

International Phonetic Esoteric Language, cracks @bigyihsuan's answer

{32}χu{33}χu{34}χu{35}χu{36}χu{37}χu{38}χu{39}χu{40}χu{41}χu{42}χu{43}χu{44}χu{45}χu{46}χu{65}χu{66}χu{67}χu{68}χu{69}χu{70}χu{71}χu{72}χu{73}χu{74}χu{75}χu{76}χu{77}χu{78}χu{79}χu{80}χu{81}χu{82}χu{83}χu{84}χu{85}χu{86}χu{87}χu{88}χu{89}χu{90}χu{91}χu{92}χu{93}χu{94}χu{95}χu{96}χu

To my knowledge, the only way to test this is with the interpreter here.

| improve this answer | |
\$\endgroup\$
3
\$\begingroup\$

Perl 5 + -p, cracks Dom Hastings's third answer

Note: this solution only works in Perl up to 5.21, and prints a warning in Perl ≥5.14.

Note: this solution attempts to read from standard input. It works whether it reads empty or non-empty input, but if reading from stdin blocks, the program will block.

The code is generated by the following Perl program. It's too long to fit in a Stack Exchange answer. (It contains numbers in unary. With a small amount of effort, the numbers could be compressed to fit.)

#!/usr/bin/env perl
use warnings;
use strict;

my $output = q$ "#'+\-/0123456789:<>ABCDEFGHIJKLMNOPQRSTUVWXYZ\^`abcdefghijklmnopqrstuvwxyz|~$;

sub encode_integers {
    # Express numbers in unary: construct a list of the desired length
    # and force it into scalar context.
    $_[0] =~ s{(\d+)}{$1 ? '($==@{[_' . ',_' x ($1-1) . ']})' : '$['}eg;
}

my $code = <<'EOF';
$_ = *_;                                        # $_ = "*main::_"
# Note that bare ?REGEXP? without a leading m requires perl <5.22
m?..(.)..(..)?;                                  # $1 = "a"; $2 = "::"
@_=${1}.._;                                     # @__ = "a".."z"
$__=(____&($_[2].$_[14].$_[17].$_[4])).${2};    # $__ = "CORE::"
$___=$__.$_[2].$_[7].$_[17];                    # $___ = "CORE::chr"
$____=$__.$_[18].$_[24].$_[18].$_[22].$_[17].$_[8].$_[19].$_[4]; # $____ = "CORE::syswrite"
$_____=______&($_[18].$_[19].$_[3].$_[14].$_[20].$_[19]); # $_____ = "STDOUT"
&$____($_____,OUTPUT);                          # syswrite(STDOUT, chr(32).chr(34)...)
$_=$@;                                          # Empty $_ because -p might print it
EOF

# Remove comments and whitespace
$code =~ s/#.*//g;
$code =~ tr/ \n//d;
# Inject desired output
$code =~ s{OUTPUT}{join('.', map {sprintf('&$___(%d)', ord($_))}
                                 split(//, $output))}eg;
encode_integers($code);

# For the sake of -p, we also need to exit after the first input line.
my $exit = '$______=$__.$_[4].$_[23].$_[8].$_[19];&$______(0)';
encode_integers($exit);

print "$code;$exit}$code;{";

Try it online! — adapted for modern Perl versions, with the extra m before ?…? that isn't needed in Perl up to 5.21. (To reiterate: the version on TIO does not obey the restricted source constraint, but works in modern Perl. My solution obeys the restricted source constraint, but doesn't work in modern Perl.)

The first thing we do is obtain a string 'a'. We do this by pattern-matching on *_ which is '*main::_'. The characters m and / are forbidden, but ? is permitted, so we can use the m?…? pattern matching form. This form requires an explicit m in modern Perl, but classic Perl allowed a bare ?…? (with the risk that occasionally Perl would misparse the ? as part of the … ? … : … construct). Due to the use of this construct, the program no longer works with Perl 5.22 and above. While we're at it, we grab :: as well; this isn't strictly necessary but saves work later.

Having 'a', we can construct the range 'a'..'_' which is the list of lowercase ASCII letters from 'a' to 'z'. (It should really be 'a'..'z' but perl doesn't mind.) We can now build strings containing letters with $_[INDEX]. Positive integers are expressed as the length of the list (_,_,…,_) in scalar context.

Next we construct the names of some built-in functions from the CORE module. With the function name in $var, we can call it with &$var(…). The . concatenation operator, the chr function (expressed as CORE::chr), and the ability to express integers lets us construct arbitrary strings.

There's no CORE::print, so we use CORE::syswrite(STDOUT, …) instead.

For plain perl the work would be done. For perl -p, we need to do a bit of additional work. perl -p is equivalent to putting the source code in a while (<>) { … } loop. It's so equivalent that you can put an extra } in the source code to close the brace of the loop, followed by an extra { so that the program as a whole is syntactically correct. The structure of the program is:

while (<>) {
    print stuff; $_ = "";
    exit;
    }
    print stuff; $_ = "";
    {
} continue { print $_; }

where the indented part is the source code and the unindented part is the -p wrapper code. So if there is a line of input, the loop body is executed and the program exits. If there is no input, the loop body doesn't run, and the next instructions (the second print stuff;) are executed.

| improve this answer | |
\$\endgroup\$
3
\$\begingroup\$

QBasic 1.1, cracks DLosc's second answer

The string to print is:

C,c

Solution:

X$ = MKL$(543370307)
PRINT RTRIM$(X$)

This was much trickier than the first version. This time I couldn't use a comma. That was mainly to prevent writing memory with POKE, but it also ruled out every other function with multiple arguments.

After all my initial ideas failed, I started looking for any functions that took a single argument and were even vaguely related to strings. Eventually I found the MKL$ function, which lets you encode Long values in ASCII. The documentation points out that this "can save up to 6 bytes of storage space" !

MKL$ always returns 4 bytes. If the number isn't long enough, the ASCII encoding will be padded with \0, which QBasic annoyingly prints as whitespace but doesn't trim. I ended up finding a number that gets encoded as C,c with a trailing space, so I could use RTRIM$ to remove that space, all without typing a comma.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Very nice! Pretty similar to what I had. \$\endgroup\$ – DLosc Jul 29 at 13:23
3
\$\begingroup\$

Ruby, cracks Dingus's answer

#!/usr/bin/env ruby
class Fixnum
  def !
    chr
  end
end
s = !112 + !46 + !96 + !39 + !92 + !34 + !63 + !37 + !40 + !91 + !58 + !60
eval !112 + !114 + !105 + !110 + !116 + !34 + s + !34

Can't call methods without .? Yes you can, if they're operators.

Try it online!

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ That was quick! Very clever, though again nothing like mine. I'm going to give this one more shake... \$\endgroup\$ – Dingus Jul 31 at 9:21
3
\$\begingroup\$

Dupdog, 1813 bytes, cracks @HighlyRadioactive's answer

This should be really really trivial . . . The answer is suspiciously short

Safe to say this is not the intended answer then:

a?a?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????a?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????a?????a???????????????????????????????????????????????????????????????????????????????????????????????????????????a?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????a?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????a???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????a???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????a

The program was created using a Python script written by @kennytm. I couldn't find a publicly available Dupdog interpreter so I rolled my own based on the language spec at Esolangs.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Hurray finally someone to crack my answer!! \$\endgroup\$ – null Aug 1 at 6:07
  • \$\begingroup\$ Also WHY DON'T YOUR INTERPRETER HALT AFTER OUTPUTTING A NUMBER??? (Hey wait I forgot to turn off CapsLock) \$\endgroup\$ – null Aug 1 at 6:24
  • \$\begingroup\$ @HighlyRadioactive Because it wasn't well tested :). Fixed. \$\endgroup\$ – Dingus Aug 1 at 7:22
2
\$\begingroup\$

JavaScript (Browser), cracks PkmnQ's answer

window.location="javascript:console.log"+String.fromCharCode`40`+String.fromCharCode`34`+String.fromCharCode`40`+String.fromCharCode`92`+String.fromCharCode`92`+String.fromCharCode`41`+String.fromCharCode`34`+String.fromCharCode`41`

Paste it in your browser's JS console! (Tested on Chrome).

Uses window.location="javascript:..." to basically get an eval, and then builds the payload ("(\\)") by using String.fromCharCode, using template literal syntax to call that method (please don't ask me why this exists in JavaScript...). Both of these tricks I got from this handy StackOverflow post.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I actually didn't consider using window.location. I only said Browser because I used the unescape function, and I wasn't sure if it worked in other places you use JS in. And I forgot String.fromCharCode existed. \$\endgroup\$ – PkmnQ Jul 25 at 18:18
  • \$\begingroup\$ Yeah, I figured there was probably another way to call methods without parentheses that would work, I just saw this first and it all worked out. \$\endgroup\$ – nthistle Jul 25 at 18:20
  • 1
    \$\begingroup\$ I wouldn't have found this if it weren't for JSF$ck. Not JSFuck, JSF$ck. Basically, it uses []["fill"]["constructor"]`$${code as string here}` \$\endgroup\$ – PkmnQ Jul 25 at 18:27
2
\$\begingroup\$

Befunge-98 (FBBI), cracks ovs' answer.

#@'+1+:00p'<1+1k

The only significant trick user here is self-modifying the , used for output into existence; I generate the characters (and the aforementioned comma) by storing the character one code point lower and adding one to it.

Try it online!

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Befunge-93, 123 bytes, cracks Ethan Chapman's answer

!:v+
 v>$$~!~!g~!!+~!!~!g~!!-:~!!-:~!!-:~!!-:~!!-:~!!-:~!!-:~!!-:~!!-:~!!-
v>~!!~!!+~!!+~!g~!!+:~!!~!!~!!+~!!+p
vx<
>:|
  @

Note that this code does read from the input, and will break if you someone manage to input null bytes, but it performs correctly on no input, and that is allowed. "A pain to implement" was a total understatement.

Try it online!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Ah, I hadn't though of reading from no input, that does make things slightly simpler. Still looks like it wasn't very fun though. \$\endgroup\$ – Ethan Chapman Jul 26 at 17:25
  • \$\begingroup\$ You could always add & and ~ to the banned character list and try again. \$\endgroup\$ – pppery Jul 26 at 17:26
  • \$\begingroup\$ I think banning & would be more useful than @, but sure, I'll post it. \$\endgroup\$ – Ethan Chapman Jul 26 at 17:28
  • \$\begingroup\$ Yes, that was a typo on my part. \$\endgroup\$ – pppery Jul 26 at 17:28
  • \$\begingroup\$ Note: I'm actually going to hold off on that new post because I want to see if I can make it a little harder first \$\endgroup\$ – Ethan Chapman Jul 26 at 17:31
2
\$\begingroup\$

Python 2, 5271 4113 621 524 bytes, cracks Mukundan's answer

r=False+False
q=True+r
u=``[]``
s=``u``[q+q]
a=`r`
b=`q`
c=`q+q`
e=`q+q+q`
f=`q+q+q+q`
g=`q+q+q+q+q`
h=`q+q+q+q+q+q`
i=`q+q+q+q+q+q+q`
exec(eval(u[r]+s+b+g+b+s+b+g+g+s+b+h+a+s+b+g+i+s+b+h+c+s+b+h+f+s+a+f+a+s+b+h+e+s+b+i+b+s+b+h+e+s+a+i+e+s+b+h+e+s+b+i+b+s+b+h+e+s+a+g+h+s+b+h+e+s+b+h+f+s+b+f+f+s+b+g+i+s+b+h+g+s+b+h+f+s+a+g+h+s+b+h+i+s+b+h+c+s+b+g+b+s+b+h+f+s+b+f+g+s+a+g+a+s+a+f+i+s+a+f+c+s+b+e+f+s+a+f+i+s+a+h+a+s+a+h+b+s+a+h+c+s+a+h+e+s+a+h+f+s+a+h+g+s+a+h+h+s+a+h+i+s+a+i+a+s+a+i+b+s+b+f+f+s+b+h+f+s+a+f+i+s+a+g+b+u[r]))

Try it online!

I will try and golf this and add a better explanation, just wanted to get the crack out there.

Explanation

The basic idea is that in python2 ` can be used to get the string representation of an object. From this we have 3 types of character we get

  • numbers. We get numbers by adding booleans to get the desired number and then converting that to its representation. We will also use the number method for indexing.
  • '. We get this by getting the representation of False and then the representation of that string. We then take the first character of that.
  • \. We get this by taking the representation of True repeatedly until the representation has a backslash to escape a quote, we then index this.

From here we build the string

'\151\155\160\157\162\164\040\163\171\163\073\163\171\163\056\163\164\144\157\165\164\056\167\162\151\164\145\050\047\042\134\047\060\061\062\063\064\065\066\067\070\071\144\164\047\051'

Which is just a pile of octal escape codes for:

import sys;sys.stdout.write('"\'0123456789dt')

Which when run does the proper output.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ May you give a documentation link about what ` does in Python2, please? \$\endgroup\$ – Kowalski Jul 26 at 20:09
  • \$\begingroup\$ @Kowalski I can't find the documentation but it is the same as repr which is documented. It is similar to str except it gets the "representation" which is something that for ordinary types should eval to the value it is passed. \$\endgroup\$ – Wheat Wizard Jul 26 at 23:00
  • \$\begingroup\$ thanks, I know repr. I only know Python3.x and this syntax seems ugly. \$\endgroup\$ – Kowalski Jul 27 at 21:40
2
\$\begingroup\$

R, 79 63 bytes, Robin Ryder's answer

x=pi*pi;cat(apropos("^.$")[c(T,sum(x,T),sum(x,pi))],F:x,sep='')

Try it online!

Being allowed to use () let me use apropos to grab the length-one function names, and then just index them to get the appropriate -/+.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Well done, beautiful solution! I didn't know about apropos until today. \$\endgroup\$ – Robin Ryder Jul 26 at 19:31
  • \$\begingroup\$ Nice! Interestingly, although this works on the TIO installation of R version 3.5.2 (and hence is a valid crack), it doesn't work on my own older installation of R version 3.2.1, under which apropos("^.$") lists the same set of function names in a completely different order. No idea why. \$\endgroup\$ – Dominic van Essen Jul 27 at 7:10
2
\$\begingroup\$

Java, cracks @MCross's answer

public class Main { public static void main(String[] args) { System\u002eout\u002eprintln("" + (char)46 + (char)10); } }

Try it online!

Definitely not the intended solution, just abuses the unicode escaping technique in Java (\u002e gets interpreted as . by the compiler). Thanks to @user from the previous Java answer (now deleted) on the cop's thread where this was the intended approach.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Perl 5 + -p, cracks Dom Hastings's answer

BEGIN { $. = ARGU; ++$.; $_ = z - z; @{$.} = $$_; } $_ = BGOP; tr:A-P:!-;:; $z = $_; $n = $.; ++$.; $n .= $.; ++$.; $n .= $.; ++$.; $n .= $.; ++$.; $n .= $.; ++$.; $n .= $.; ++$.; $n .= $.; ++$.; $n .= $.; ++$.; $n .= $.; $z .= $n; $_ = $.; tr: -z:#-z:; $z .= $_; $_ = BLEPRU; tr:A-Z:B-Z:; $z .= $_; $_ = bdi; tr:G-z:A-z:; $z .= $_; $_ = fijlouw; tr:_-z:f-:; $z .= $_; $_= $z; 

This code must be stored in a file (-e won't work), but the file name doesn't matter. The source code must be a single line (a shebang line breaks it). A trailing newline in the source code is optional. The `` character in tr:_-z:f-: is DEL (ASCII 127); any character code above 126 would do.

-p gives us automatic printing, which is nice since the core printing functions (print, syswrite, say if we managed to define it) have forbidden names. But it requires input. Fortunately we can change where the input comes from in a BEGIN block: @ARGV specifies where the input comes from, so we set this to the script file, which is guaranteed to exist. We arrange for exactly one line of input, so the code after the BEGIN block runs exactly once and the final value of $_ will be printed at the end.

The rest is simple string processing tricks to set @ARGV and $_ without using any of the forbidden characters. Here's an expanded version with comments.

#!/usr/bin/perl -p
BEGIN {
    # Set @ARGV to $0, a file that we know contains exactly one line.
    # This assumes that perl is invoked on a script file, not with -e.
    $. = ARGU; ++$.;
    $_ = z - z;
    @{$.} = $$_;
}
# For the expanded version only: only process the first line.
print "\n" and exit if $line++;
# Build the string using tr to shift permitted characters into forbidden
# characters. Run tr on $_ since =~ isn't permitted. The . operator is
# permitted so we can concatenate the pieces the simple way.
$_ = BGOP; tr:A-P:!-;:; $z = $_;
# For the digits, arithmetic is more convenient than tr.
$n = $.; ++$.; $n .= $.; ++$.; $n .= $.; ++$.; $n .= $.; ++$.; $n .= $.; ++$.; $n .= $.; ++$.; $n .= $.; ++$.; $n .= $.; ++$.; $n .= $.; $z .= $n;
$_ = $.; tr: -z:#-z:; $z .= $_;
$_ = BLEPRU; tr:A-Z:B-Z:; $z .= $_;
$_ = bdi; tr:G-z:A-z:; $z .= $_;
$_ = fijlouw; tr:_-z:f-:; $z .= $_;
# $_ will be printed thanks to -p
$_= $z;

Try it online!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Nice work! Definitely not what I intended, so I'll add a couple more exclusions and try again! \$\endgroup\$ – Dom Hastings Jul 27 at 10:59
2
\$\begingroup\$

R, cracks JDL's challenge

String to print:

([{

Solution:

"?"=intToUtf8
"+"=c
"!"=cat
!?40+91+123

Try it online!

Explanation: this code is equivalent to

cat(intToUtf8(c(40, 91, 123)))
| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ Nice. I had this before seeing you had already cracked it! \$\endgroup\$ – Giuseppe Jul 27 at 12:26
  • 1
    \$\begingroup\$ @Giuseppe It looks like apropos is becoming your tool of choice! \$\endgroup\$ – Robin Ryder Jul 27 at 12:28
  • \$\begingroup\$ I had originally started with magrittr::%>%` -> `%>%`` (SO comments will muck up the rendering of that one) but then realised as you did that inbuilt unary operators would be just fine \$\endgroup\$ – JDL Jul 27 at 12:36
  • 1
    \$\begingroup\$ @RobinRyder it's quite useful for this challenge, unsurprisingly, and even when a is banned, you can replicate it quite a lot by using ls() anyway. get is also pretty useful in conjunction to get functions back from the name. \$\endgroup\$ – Giuseppe Jul 27 at 14:40
  • 1
    \$\begingroup\$ @RobinRyder It seems quite ironic that @Giuseppe Cracked my second challenge (that was aimed to make indexing difficult) using indexing, whereas the solution that I had in mind actually used apropos() (after lowercasing) just to avoid this. \$\endgroup\$ – Dominic van Essen Jul 27 at 15:38
2
\$\begingroup\$

Perl 5 + -p, cracks Dom Hastings's second answer

BEGIN { $. = ARGU; ++$.; $_ = z - z; @{$.} = $$_; }  $f = b; ++$f; $f .= hr; $_ = B; ++$_; $f = $_ . ORE . :: . $f;  $_ = &$f(hex(f) + hex(f) + $. + $. + $. + $.); $_ .= &$f(hex(f) + hex(e) + hex(a)); $_ .= &$f(hex(f) + hex(f) + hex(f) + $. + $.); $_ .= ($.-$.) . $. . ($.+$.) . ($.+$.+$.) . ($.+$.+$.+$.) . ($.+$.+$.+$.+$.) . ($.+$.+$.+$.+$.+$.) . ($.+$.+$.+$.+$.+$.+$.) . ($.+$.+$.+$.+$.+$.+$.+$.) . ($.+$.+$.+$.+$.+$.+$.+$.+$.); $_ .= &$f(hex(f) * ($.+$.+$.+$.)); $A = B; ++$A; $_ .= $A; $A = L; ++$A; $_ .= $A; $A = O; ++$A; $_ .= $A; ++$A; $_ .= $A; $A = R; ++$A; $_ .= $A; ++$A; $_ .= $A; $A = U; ++$A; $_ .= $A; $A = X; ++$A; $_ .= $A; $_ .= &$f(hex(f) * ($.+$.+$.+$.+$.+$.) + $. + $.); $_ .= &$f(hex(f) * ($.+$.+$.+$.+$.+$.) + $. + $. + $. + $.); $_ .= &$f(hex(f) * ($.+$.+$.+$.+$.+$.) + $. + $. + $. + $. + $. + $.); $a = b; ++$a; $_ .= $a; $a = l; ++$a; $_ .= $a; $a = o; ++$a; $_ .= $a; ++$a; $_ .= $a; $a = r; ++$a; $_ .= $a; ++$a; $_ .= $a; $a = u; ++$a; $_ .= $a; $a = x; ++$a; $_ .= $a; $_ .= &$f(hex(f) * ($.+$.+$.+$.+$.+$.+$.+$.) + $. + $. + $. + $.); $_ .= &$f(hex(f) * ($.+$.+$.+$.+$.+$.+$.+$.) + $. + $. + $. + $. + $. + $.);

The first part to read input from the script file is identical to my first crack. The second part constructs a reference to the chr built-in function using unquoted literals and the ++ operator on all-letters string variables.

#!/usr/bin/perl -p
BEGIN {
    # Set @ARGV to $0, a file that we know contains exactly one line.
    # This assumes that perl is invoked on a script file, not with -e.
    $. = ARGU; ++$.;
    $_ = z - z;
    @{$.} = $$_;
}
# For the expanded version only: only process the first line.
print "\n" and exit if $line++;

# Set $f to "CORE::chr". We can then call chr as &$f(NUMERIC_VALUE).
$f = b; ++$f; $f .= hr; $_ = B; ++$_; $f = $_ . ORE . :: . $f;

# We have $. == 1 and we're allowed to use + which makes building all
# positive integers trivial. This code uses a few shortcuts.
$_ = &$f(hex(f) + hex(f) + $. + $. + $. + $.);
$_ .= &$f(hex(f) + hex(e) + hex(a));
$_ .= &$f(hex(f) + hex(f) + hex(f) + $. + $.);
$_ .= ($.-$.) . $. . ($.+$.) . ($.+$.+$.) . ($.+$.+$.+$.) . ($.+$.+$.+$.+$.) . ($.+$.+$.+$.+$.+$.) . ($.+$.+$.+$.+$.+$.+$.) . ($.+$.+$.+$.+$.+$.+$.+$.) . ($.+$.+$.+$.+$.+$.+$.+$.+$.);
$_ .= &$f(hex(f) * ($.+$.+$.+$.));
$A = B; ++$A; $_ .= $A;
$A = L; ++$A; $_ .= $A;
$A = O; ++$A; $_ .= $A; ++$A; $_ .= $A;
$A = R; ++$A; $_ .= $A; ++$A; $_ .= $A;
$A = U; ++$A; $_ .= $A;
$A = X; ++$A; $_ .= $A;
$_ .= &$f(hex(f) * ($.+$.+$.+$.+$.+$.) + $. + $.);
$_ .= &$f(hex(f) * ($.+$.+$.+$.+$.+$.) + $. + $. + $. + $.);
$_ .= &$f(hex(f) * ($.+$.+$.+$.+$.+$.) + $. + $. + $. + $. + $. + $.);
$a = b; ++$a; $_ .= $a;
$a = l; ++$a; $_ .= $a;
$a = o; ++$a; $_ .= $a; ++$a; $_ .= $a;
$a = r; ++$a; $_ .= $a; ++$a; $_ .= $a;
$a = u; ++$a; $_ .= $a;
$a = x; ++$a; $_ .= $a;
$_ .= &$f(hex(f) * ($.+$.+$.+$.+$.+$.+$.+$.) + $. + $. + $. + $.);
$_ .= &$f(hex(f) * ($.+$.+$.+$.+$.+$.+$.+$.) + $. + $. + $. + $. + $. + $.);

# $_ will be printed thanks to -p

Try it online!

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

JavaScript (Browser), cracks Sparkles the Unicorn's second answer

eval('a=1<<1+1+1+1+1+1;b=1+1+1<<1+1+1+1;console.log(S'+(!!1+'').slice(1-1,1)+'ring.'+(!1+'').slice(1-1,1)+'romCharCode(++a,++a,a+=1+1,++a,++a,++a,a+=1+1,a+=1+1+1+1+1,++a,++a,++a,a+=1+1+1,++a,++a,a+=1+1+1,++a,b+=1+1,++b,++b,++b,++b,++b,++b,++b,b-11+1+1,111+1+1+1+1+1,111-11+1+1,++a))')

Try it online!

Because [] is banned, we use string method .slice instead to grab the t and f, and then we have String.fromCharCode again. I use some variables to make it easier to build the numbers, but it would technically work with simple 1+1+1+... too.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

R, cracks Robin Ryder's challenge

The string to print is

t <-
"0123456789=[\\]^_`v"

We're not allowed to use the digits 0 to 9, but we can make numbers using sum and T

(+T) # 1
(T+T) # 2
(T+T+T) # 3 
# ...and so on

We'll need the numbers 116,32,60,45,10,34,48,49,50,51,52,53,54,55,56,57,61,91,92,93,94,95,96,118 and 34, which are the ASCII values of all the characters in the string to print.
I'm not going to make them now *, so I hope you, dear reader, will trust that I could.

Now, we use these numbers inside the following program (substitute each number for sum(T+T+...+T+T)):

do.call(el(ls(9),297),lapply(do.call(apropos('in.ToU.f'),lapply(F,pmax,(c(116,32,60,45,10,34,48,49,50,51,52,53,54,55,56,57,61,91,92,93,94,95,96,118,34)))),c))

Try it online! * with numbers correctly substituted for (T+T...+T) expressions

How?

  • We convert the vector of numbers c(116,...34) into a list using lapply(F,pmax,...)
  • Then we use this as an argument to do.call(apropos('in.ToU.f'),...), which calls the function intToUtf8()
  • Finally, we send the output to cat. Since cat contains a 't' we can't call it directly, so we look it up in the list ls(9) of all functions. It's number 297 in the TIO installation of R.
| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ You could just do +T for 1, +T+T for 2, and so forth. No need to wrap it into a sum! \$\endgroup\$ – Giuseppe Jul 27 at 19:52
  • \$\begingroup\$ You're right, of course, and that's more elegant! I got lazy and just left the first thing that came into my head because there's no golfing incentive. \$\endgroup\$ – Dominic van Essen Jul 28 at 7:30
2
\$\begingroup\$

Wolfram Language (Mathematica), 1422 bytes, cracks att's answer

this question is named incorrectly, we're actually the cops, trying to prevent all those evil newcomers from posting challenges we don't like /s
This is just escape sequences for Print@FromCharacterCode@{97, 98, 100, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 10, 123, 32, 60, 45, 62, 32, 44, 32, 126, 44, 32, 38, 125, 91, 40, 42, 64, 41, 91, 93, 93, 10}.

\:0050\:0072\:0069\:006E\:0074\:0040\:0046\:0072\:006F\:006D\:0043\:0068\:0061\:0072\:0061\:0063\:0074\:0065\:0072\:0043\:006F\:0064\:0065\:0040\:007B\:0039\:0037\:002C\:0020\:0039\:0038\:002C\:0020\:0031\:0030\:0030\:002C\:0020\:0031\:0030\:0032\:002C\:0020\:0031\:0030\:0033\:002C\:0020\:0031\:0030\:0034\:002C\:0020\:0031\:0030\:0035\:002C\:0020\:0031\:0030\:0036\:002C\:0020\:0031\:0030\:0037\:002C\:0020\:0031\:0030\:0038\:002C\:0020\:0031\:0030\:0039\:002C\:0020\:0031\:0031\:0030\:002C\:0020\:0031\:0031\:0031\:002C\:0020\:0031\:0031\:0032\:002C\:0020\:0031\:0031\:0033\:002C\:0020\:0031\:0031\:0034\:002C\:0020\:0031\:0031\:0035\:002C\:0020\:0031\:0031\:0036\:002C\:0020\:0031\:0031\:0037\:002C\:0020\:0031\:0031\:0038\:002C\:0020\:0031\:0031\:0039\:002C\:0020\:0031\:0032\:0030\:002C\:0020\:0031\:0032\:0031\:002C\:0020\:0031\:0032\:0032\:002C\:0020\:0031\:0030\:002C\:0020\:0031\:0032\:0033\:002C\:0020\:0033\:0032\:002C\:0020\:0036\:0030\:002C\:0020\:0034\:0035\:002C\:0020\:0036\:0032\:002C\:0020\:0033\:0032\:002C\:0020\:0034\:0034\:002C\:0020\:0033\:0032\:002C\:0020\:0031\:0032\:0036\:002C\:0020\:0034\:0034\:002C\:0020\:0033\:0032\:002C\:0020\:0033\:0038\:002C\:0020\:0031\:0032\:0035\:002C\:0020\:0039\:0031\:002C\:0020\:0034\:0030\:002C\:0020\:0034\:0032\:002C\:0020\:0036\:0034\:002C\:0020\:0034\:0031\:002C\:0020\:0039\:0031\:002C\:0020\:0039\:0033\:002C\:0020\:0039\:0033\:002C\:0020\:0031\:0030\:007D

I really hope this is not the intended solution, but then I ran

Names[] ~ Select ~ (ContainsNone[Characters@#, Characters@"abdfghijklmnopqrstuvwxyz"]&)

, and, ignoring random unicode characters, this is the output: FE`AC, FE`c, C, CDF, D, FE`e, E, FE`e$, FE`FT, FE`FTU, GCD, I, K, LCM, N, O, PDF, Re, FE`SC, Sec, URL, Vee, FE`WW, and the only way to call any of this stuff seems to be //.

Try it online!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Not the intended solution. Didn't block capital letters, whoops. \$\endgroup\$ – att Jul 28 at 17:04
  • \$\begingroup\$ Actually, now that I think about it I'm skeptical whether it's possible to prevent purely escape-sequence solutions without blocking some digits, (and, in this case, especially when e allows CharacterRange). Back to the drawing board we go. \$\endgroup\$ – att Jul 28 at 18:03
2
\$\begingroup\$

APL (Dyalog Unicode), 112 bytes, Cracks Bubbler's answer

a←'a'(⎕NCREATE⍠'IfExists' 'Replace')0⋄117 118 85 86 ¯30 ¯108 ¯68⎕NREPLACE a 0⋄⍞←⊃⎕NGET'a'

Isn't too impressive I'm afraid, just writes the bytes to a file then reads it back as text. Couldn't use ⎕ARBOUT to write out the file because of the O, but ⎕NREPLACE works fine.

Try it online!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I had several ways to crack it, but didn't really think of using file I/O. Nice job. \$\endgroup\$ – Bubbler Jul 28 at 23:24
2
\$\begingroup\$

Malbolge, cracks Pizgenal Filegav's answer

String to print:

To

Solution:

DCBA@?"7[54XE7UB.-2bNMLKK8k)GXD}Ce/yba=

Try it online!

I have no idea how this works! I found the solution with this generator, then decided against posting it, since that didn't seem to fit the spirit of the challenge. But I decided I'd post it anyway when I saw Dingus's Dupdog answer, which also used generated code.

| improve this answer | |
\$\endgroup\$
  • 2
    \$\begingroup\$ All's fair in code golf and war ;) \$\endgroup\$ – Dingus Aug 1 at 7:14
  • \$\begingroup\$ That's a bit different than my original solution, but I'm not surprised there's another one. Good job! \$\endgroup\$ – Pizgenal Filegav Aug 1 at 16:51
2
\$\begingroup\$

SimpleTemplate, 175 bytes, cracks @IsmaelMiguel's answer

{@set j "b"}{@set k "{@in\x63 j}"}{@eval k}{@print j}{@set j "g"}{@set k "{@in\x63 j}"}{@eval k}{@print j}{@set j "n"}{@set k "{@in\x63 j}"}{@eval k}{@print j}{@print VERSION}

Try it online!

I had a hunch that 0.84 would be a hardcoded version number, and so it was. Then I just needed a way to get cho. The natural way to do this is with inc (increment) acting on b, g, and n, but without c I had to take the slightly longer eval route to get there.

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ Incidentally, I believe I found a bug along the way: replace every j with an i and cho disappears from the output. From a small sample of other letters, i seems to be the only one that produces the bug. \$\endgroup\$ – Dingus Aug 1 at 9:38
  • 1
    \$\begingroup\$ O.o That's way more complicated than I expected it to be. But you were super close to the intented solution! And yes, the 0.84 is indeed the version number. Regarding the bug, I will try to check it. \$\endgroup\$ – Ismael Miguel Aug 1 at 17:24
  • \$\begingroup\$ @IsmaelMiguel For cho, my first thought was actually to index into a list of functions to get echo and then somehow remove the e. But I don't speak PHP and couldn't find a way to do it (if it's even possible). \$\endgroup\$ – Dingus Aug 2 at 3:45
  • 1
    \$\begingroup\$ It is entirely possible, but you don't need PHP for it. In PHP, you do $fns = get_defined_functions()["int\x65rnal"]; print($fns[1][3] . $fns[9][3] . $fns[16][4]);. In my language, you can do {@set j "{@call get_defined_fun\x63ti\x6fns into x}{@set k \"int\x65rnal\"}{@set x x.[k]}"}{@eval j}{@print "#{x.1.3}#{x.9.3}#{x.16.4}#{VERSION}"} (it includes the version number) as well. \$\endgroup\$ – Ismael Miguel Aug 2 at 11:48
2
\$\begingroup\$

Haskell, cracks Ad Hoc Garf Hunter's answer

main|[uuuuuuuuu,iiiiiiiiiiiii,iiiiiiiiiiii,iiiiiiiiiii,iiiiiiiiii,iiiiiiiii,iiiiiiii,iiiiiii,iiiiii,iiiii,iiii,iii,ii,i,nnnnnnn,nnnnnn,nnnnn,uuuuuuuu,nnnn,uuuuuuu,aaaaaaaaaaaaai,aaaaaaaaaaaai,aaaaaaaaaaai,aaaaaaaaaai,aaaaaaaaai,aaaaaaaai,aaaaaaai,aaaaaai,aaaaai,aaaai,aaai,aai,ai,aaaaaaaaaaaaa,aaaaaaaaaaaa,aaaaaaaaaaa,aaaaaaaaaa,aaaaaaaaa,aaaaaaaa,aaaaaaa,aaaaaa,aaaaa,aaaa,aaa,aa,a,mmmmmmmmmmmmmmm,mmmmmmmmmmmmmm,uuuuuu,uuuuu,uuuu,mmmmmmmmmmmmm,mmmmmmmmmmmm,mmmmmmmmmm,mmmmmmmmm,mmmmmmmm,mmmmmmm,mmmmmm,mmmmm,mmmm,mmm,mm,m,pppppppppppp,uuu,uu,u,ppppppppppp,pppppppppp,ppppppppp,pppppppp,ppppppp,pppppp,ppppp,pppp,ppp,pp,p,nnn,urrrrrrrrrrrrrrrrrrrrrr,urrrrrrrrrrrrrrrrrrrrrrrr,urrrrrrrrrrrrrrrrrrrr,urrrrrrrrrrrrrrrrrrr,urrrrrrrrrrrrrrrrrr,urrrrrrrrrrrrrrrrr,urrrrrrrrrrrrrrrr,urrrrrrrrrrrrrr,urrrrrrrrrrrrr,urrrrrrrrrrrr,urrrrrrrrrrr,urrrrrrrrrr,urrrrrrrrr,urrrrrrrr,urrrrrrr,urrrrrr,urrrrr,urrrr,urrr,urr,ur,nn,n,rrrrrrrrrr,rrrrrrrrr,rrrrrrrr,rrrrrrr,rrrrrr,rrrrr,rrrr,rrr,rr]<-['n','m'..],[t,tt,ttt,tttt,ttttt,tttttt,ttttttt,tttttttt,ttttttttt,tttttttttt,ttttttttttt,tttttttttttt,ttttttttttttt,r]<-['n'..'{'],h<-putChar.minimum=h[n]>>h[nn]>>h[nnn]>>h[p]>>h[pp]>>h[ppp]>>h[pppp]>>h[ppppp]>>h[pppppp]>>h[pppppppp]>>h[ppppppppp]>>h[pppppppppp]>>h[ppppppppppp]>>h[pppppppppppp]>>h[m]>>h[mm]>>h[mmm]>>h[mmmm]>>h[mmmmm]>>h[mmmmmm]>>h[mmmmmmm]>>h[mmmmmmmm]>>h[mmmmmmmmm]>>h[mmmmmmmmmm]>>h[mmmmmmmmmmmm]>>h[mmmmmmmmmmmmmm]>>h[mmmmmmmmmmmmm]>>h[mmmmmmmmmmmmmmm]>>h[aa]>>h[aaaaa]>>h[aaaa]>>h[a]>>h[aaaaaa]>>h[aaaaaaa]>>h[aaaaaaaa]>>h[aaaaaaaaa]>>h[aaaaaaaaaa]>>h[aaaaaaaaaaa]>>h[aaaaaaaaaaaa]>>h[aaaaaaaaaaaaa]>>h[ai]>>h[aai]>>h[aaai]>>h[aaaai]>>h[aaaaai]>>h[aaaaaai]>>h[aaaaaaai]>>h[aaaaaaaai]>>h[aaaaaaaaai]>>h[aaaaaaaaaai]>>h[aaaaaaaaaaai]>>h[aaaaaaaaaaaai]>>h[aaaaaaaaaaaaai]>>h[nnnn]>>h[nnnnn]>>h[nnnnnn]>>h[nnnnnnn]>>h[ii]>>h[iii]>>h[iiii]>>h[iiiii]>>h[iiiiii]>>h[iiiiiii]>>h[iiiiiiiiii]>>h[iiiiiiiiiii]>>h[iiiiiiiiiiii]>>h[tt]>>h[tttt]>>h[tttttt]>>h[ttttttttt]>>h[tttttttttt]>>h[ttttttttttt]>>h[tttttttttttt]>>h[ttttttttttttt]

Try it online!

Probably not quite the intended method. minimum ends up been crucial to my method. It is used as a replacement for head.

How it works

This uses pattern guards on main to pattern match the char from two lists. One generated by ['n','m',..], and one generated by ['n'..'{'].

Since function application is hard unless the arguemnt is a list, we create a function (called h) that is putChar modified to work with singleton lists. This is done by composing putChar and minimum in a pattern guard.

The body of main is just applying h to each character that we have matched and combing the IO actions with (>>).

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ Very nice! My intended method uses {--} as a substitute for space since it breaks tokenization. Other than the fact I used shorter variable names and a slightly different combination of pattern matching this is virtually the same. \$\endgroup\$ – Wheat Wizard Aug 1 at 13:54
  • 1
    \$\begingroup\$ @AdHocGarfHunter Ah, I was wondering what the braces were for. There didn't seem to be the opportunity to use them as replacement for layout as all the layout heralds I thought of were impossible. I even thought about doing something with record creation at one point. \$\endgroup\$ – Potato44 Aug 1 at 14:08
2
\$\begingroup\$

Fortran (GFortran), cracks Dingus's answer

      INTEGER :: Izero = AND(BIT_SIZE(Izero), NOT(BIT_SIZE(Izero)))
      CHARACTER(BIT_SIZE(Izero)) :: out
      CHARACTER(BIT_SIZE(Izero)) :: fmt
      I = IBSET(Izero, Izero)
      I_ = SHIFTL(I, I)
      I__ = SHIFTL(I_, I)
      I___ = SHIFTL(I__, I)
      I____ = SHIFTL(I___, I)
      I_____ = SHIFTL(I____, I)
      I______ = SHIFTL(I_____, I)
      J=I
      K=OR(I___,I_____)
      fmt(J:J) = ACHAR(K)
      J=I_
      K=OR(I,I______)
      fmt(J:J) = ACHAR(K)
      J=OR(I,I_)
      K=OR(OR(I,I____),I_____)
      fmt(J:J) = ACHAR(K)
      J=I__
      K=OR(OR(I___,I____),I_____)
      fmt(J:J) = ACHAR(K)
      J=OR(I,I__)
      K=OR(OR(I,I___),I_____)
      fmt(J:J) = ACHAR(K)
      J=I
      K=OR(I____,I______)
      out(J:J) = ACHAR(K)
      J=I_
      K=OR(OR(I____,I_____),I______)
      out(J:J) = ACHAR(K)
      J=OR(I,I_)
      K=OR(OR(I,I____),I_____)
      out(J:J) = ACHAR(K)
      J=I__
      K=OR(OR(I_,I____),I_____)
      out(J:J) = ACHAR(K)
      J=OR(I,I__)
      K=OR(OR(OR(I,I_),I____),I_____)
      out(J:J) = ACHAR(K)
      J=OR(I_,I__)
      K=OR(OR(I__,I____),I_____)
      out(J:J) = ACHAR(K)
      J=OR(OR(I,I_),I__)
      K=OR(OR(OR(I,I__),I____),I_____)
      out(J:J) = ACHAR(K)
      J=I___
      K=OR(OR(OR(I_,I__),I____),I_____)
      out(J:J) = ACHAR(K)
      J=OR(I,I___)
      K=OR(OR(OR(OR(I,I_),I__),I____),I_____)
      out(J:J) = ACHAR(K)
      J=OR(I_,I___)
      K=OR(OR(I___,I____),I_____)
      out(J:J) = ACHAR(K)
      J=OR(OR(I,I_),I___)
      K=OR(OR(OR(I,I___),I____),I_____)
      out(J:J) = ACHAR(K)
      J=OR(I__,I___)
      K=OR(I____,I_____)
      out(J:J) = ACHAR(K)
      J=OR(OR(I,I__),I___)
      K=OR(OR(OR(I,I_),I__),I_____)
      out(J:J) = ACHAR(K)
      J=OR(OR(I_,I__),I___)
      K=OR(I_,I_____)
      out(J:J) = ACHAR(K)
      J=OR(OR(OR(I,I_),I__),I___)
      K=OR(OR(OR(I,I_),I___),I_____)
      out(J:J) = ACHAR(K)
      J=I____
      K=OR(OR(OR(I,I__),I___),I_____)
      out(J:J) = ACHAR(K)
      J=OR(I,I____)
      K=OR(OR(I_,I___),I_____)
      out(J:J) = ACHAR(K)
      J=OR(I_,I____)
      K=OR(OR(OR(OR(I,I_),I__),I___),I_____)
      out(J:J) = ACHAR(K)
      WRITE(OR(I_,I__), fmt) out
      END

Try it online!

Encoding integers without digits was tedious so I used a generator script.

#!/usr/bin/env perl
use warnings;
use strict;

my $output = 'Pp1234567890\'"+-*/';

# Izero = 0, I = 1, I_ = 2, I__ = 4, I___ = 8, ...
sub encode_integer {
    my ($n) = @_;
    if ($n == 0) {
        return 'Izero';
    }
    my $k = 0;
    while (($n & 1) == 0) {
        $n >>= 1;
        ++$k;
    }
    my $expr = 'I' . '_' x $k;
    while ($n != 0) {
        $n >>= 1;
        ++$k;
        if ($n & 1) {
            $expr = sprintf('OR(%s,%s)', $expr, 'I' . '_' x $k);
        }
    }
    return $expr;
}

sub set_char {
    my ($variable, $pos, $num) = @_;
    return <<EOF;
J=$pos
K=$num
$variable(J:J) = ACHAR(K)
EOF
}

sub build_string {
    my ($variable, $string) = @_;
    my @chars = split(//, $string);
    my $result = '';
    foreach my $i (1..@chars) {
        $result .= set_char($variable, $i, ord($chars[$i-1]));
    }
    return $result;
}

my $header = <<'EOF';
INTEGER :: 0 = AND(BIT_SIZE(0), NOT(BIT_SIZE(0)))
CHARACTER(BIT_SIZE(0)) :: out
CHARACTER(BIT_SIZE(0)) :: fmt
1 = IBSET(0, 0)
2 = SHIFTL(1, 1)
4 = SHIFTL(2, 1)
8 = SHIFTL(4, 1)
16 = SHIFTL(8, 1)
32 = SHIFTL(16, 1)
64 = SHIFTL(32, 1)
EOF

my $footer = <<'EOF';
WRITE(6, fmt) out
END
EOF

my $code = ($header .
            build_string('fmt', sprintf('(A%d)', length($output))) .
            build_string('out', $output) .
            $footer);
$code =~ s/[0-9]+/encode_integer($&)/eg;
$code =~ s/^/      /mg;
print $code;

The most basic way to print something in Fortran is PRINT but that's forbidden. GFortran has a more convenient function FPUT to print a character but it's also forbidden. We'll have to use WRITE. Its syntax is WRITE(unit, format) data where unit designates the output file, format describes how to format the output, and data is the data to write. WRITE adds a trailing newline so we'll have to produce the output in one go.

The unit can be either * meaning the default output, or an expression that returns an integer. Since * is forbidden, we need an integer. Standard output is unit 6.

The format can be either * or some specifications in parentheses. It can be written literally in the source code or can come dynamically from a string varible. We'll need forbidden characters in the format so it'll have to be dynamic, in the variable fmt. We want to print 18 characters so the format is (A18).

This leaves the problem of constructing strings. We can construct individual characters from their value with ACHAR, and set the characters of a string variable one at a time. So all that remains is to construct integers.

Modern Fortran has bitwise operations on integers. I used SHIFTL and OR (IOR in standard Fortran) to construct integers from 0 and 1. For 1, I used IBSET. For 0, I used AND of two integers. Finding an integer to start with took me a bit of time because I was looking for a compile-time constant, although that turned out to be unnecessary in the end; I could have used something like TIME(). The expressions can get big, and classic Fortran (without the forbidden PROGRAM has a line length limit, so I define constants for powers of 2 and intermediate variable while setting a character of a string).

To declare the strings, I needed to express their length (or more precisely their storage size which could be larger than the effective length) as a compile-time constant without using digits. I finally stumbled on BIT_SIZE which is conveniently larger than the size I needed (32 >= 18, 6).

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Well done. Bang on with the approach. \$\endgroup\$ – Dingus Aug 2 at 4:06
2
\$\begingroup\$

Rust, cracks madlaina's (edited) answer

extern "C" {
    fn system(x: &str) -> &str;
}

fn main() {
    unsafe {
        system("echo -en '\x70\x77'");
    }
}

Relies on undefined behavior (C string != &str) but it seems to work.

Try it online!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ That's very creative! Not the solution I had in mind though, so I'll post an updated version. \$\endgroup\$ – madlaina Aug 2 at 8:44
2
\$\begingroup\$

Perl 5, cracks @Gilles 'SO- stop being evil''s answer 10359 bytes

Note that the link below includes /, but the code for Perl 5.20.3 uses ? instead to meet the rules. TIO has a newer Perl and doesn't support the ?...? syntax.

[$_=[$?..$=]]&[$__=$$_[//]]&[$_=[$__..$=]]&[$___=$$_[//]]&[$_=[$___..$=]]&[$____=$$_[//]]&[$_=[$____..$=]]&[$_____=$$_[//]]&[$_=[$_____..$=]]&[$______=$$_[//]]&[$_=[$______..$=]]&[$_______=$$_[//]]&[$_=[$_______..$=]]&[$________=$$_[//]]&[$_=[$________..$=]]&[$_________=$$_[//]]&[$_=[$_________..$=]]&[$__________=$$_[//]]&/./&[$_=[$&.._]]&[$___________=$$_[$?]]&[$_=[$___________.._]]&[$____________=$$_[//]]&[$_=[$____________.._]]&[$_____________=$$_[//]]&[$_=[$_____________.._]]&[$______________=$$_[//]]&[$_=[$______________.._]]&[$_______________=$$_[//]]&[$_=[$_______________.._]]&[$________________=$$_[//]]&[$_=[$________________.._]]&[$_________________=$$_[//]]&[$_=[$_________________.._]]&[$__________________=$$_[//]]&[$_=[$__________________.._]]&[$___________________=$$_[//]]&[$_=[$___________________.._]]&[$____________________=$$_[//]]&[$_=[$____________________.._]]&[$_____________________=$$_[//]]&[$_=[$_____________________.._]]&[$______________________=$$_[//]]&[$_=[$______________________.._]]&[$_______________________=$$_[//]]&[$_=[$_______________________.._]]&[$________________________=$$_[//]]&[$_=[$________________________.._]]&[$_________________________=$$_[//]]&[$_=[$_________________________.._]]&[$__________________________=$$_[//]]&[$_=[$__________________________.._]]&[$___________________________=$$_[//]]&[$_=[$___________________________.._]]&[$____________________________=$$_[//]]&[$_=[$____________________________.._]]&[$_____________________________=$$_[//]]&[$_=[$_____________________________.._]]&[$______________________________=$$_[//]]&[$_=[$______________________________.._]]&[$_______________________________=$$_[//]]&[$_=[$_______________________________.._]]&[$________________________________=$$_[//]]&[$_=[$________________________________.._]]&[$_________________________________=$$_[//]]&[$_=[$_________________________________.._]]&[$__________________________________=$$_[//]]&[$_=[$__________________________________.._]]&[$___________________________________=$$_[//]]&[$_=[$___________________________________.._]]&[$____________________________________=$$_[//]]&[$_=$#_]&/./&[$_______________________________________________________________=$&]&[$________________________________________________________________=$_______________________________________________________________&$$__.$__]&[$_=$$________________________________________________________________=$_____]&/...$/&[$_=$&]&/./&[$_____________________________________=$&]&[$_=[$_____________________________________.._]]&[$______________________________________=$$_[//]]&[$_=[$______________________________________.._]]&[$_______________________________________=$$_[//]]&[$_=[$_______________________________________.._]]&[$________________________________________=$$_[//]]&[$_=[$________________________________________.._]]&[$_________________________________________=$$_[//]]&[$_=[$_________________________________________.._]]&[$__________________________________________=$$_[//]]&[$_=[$__________________________________________.._]]&[$___________________________________________=$$_[//]]&[$_=[$___________________________________________.._]]&[$____________________________________________=$$_[//]]&[$_=[$____________________________________________.._]]&[$_____________________________________________=$$_[//]]&[$_=[$_____________________________________________.._]]&[$______________________________________________=$$_[//]]&[$_=[$______________________________________________.._]]&[$_______________________________________________=$$_[//]]&[$_=[$_______________________________________________.._]]&[$________________________________________________=$$_[//]]&[$_=[$________________________________________________.._]]&[$_________________________________________________=$$_[//]]&[$_=[$_________________________________________________.._]]&[$__________________________________________________=$$_[//]]&[$_=[$__________________________________________________.._]]&[$___________________________________________________=$$_[//]]&[$_=[$___________________________________________________.._]]&[$____________________________________________________=$$_[//]]&[$_=[$____________________________________________________.._]]&[$_____________________________________________________=$$_[//]]&[$_=[$_____________________________________________________.._]]&[$______________________________________________________=$$_[//]]&[$_=[$______________________________________________________.._]]&[$_______________________________________________________=$$_[//]]&[$_=[$_______________________________________________________.._]]&[$________________________________________________________=$$_[//]]&[$_=[$________________________________________________________.._]]&[$_________________________________________________________=$$_[//]]&[$_=[$_________________________________________________________.._]]&[$__________________________________________________________=$$_[//]]&[$_=[$__________________________________________________________.._]]&[$___________________________________________________________=$$_[//]]&[$_=[$___________________________________________________________.._]]&[$____________________________________________________________=$$_[//]]&[$_=[$____________________________________________________________.._]]&[$_____________________________________________________________=$$_[//]]&[$_=[$_____________________________________________________________.._]]&[$______________________________________________________________=$$_[//]]&[$___________________________________________________________________=$$___.$________]&[$________________________________________________________________=$___________________________________________________________________&$___________________________________________]&[$_________________________________________________________________=$_____________.$_________________________.$____________________________.$_______________.$________________________________________________________________.$_________________________________________.$__________________________________________________________.$_____________________________________.$________________________________________________.$______________________________________.$_____________________________________________________________.$________________________________________________________.$_________________________________________.$_______________________________________________________]&[$___________________________________________________________________=$$___.$________]&[$__________________________________________________________________=$___________________________________________________________________&$____________________________________________]&[$____________________________________________________________________=$_____________.$_________________________.$____________________________.$_______________.$________________________________________________________________.$_______________________________________.$____________________________________________.$______________________________________________________]&[]&[$_=$_____.$_____]&[$_____________________________________________________________________=&$____________________________________________________________________]&[$_=$_____.$_______]&[$______________________________________________________________________=&$____________________________________________________________________]&[$_=$____________________________________________________.$______________________________________________________.$_____________________________________________.$__________________________________________________.$________________________________________________________.$__________________________________________________________________.$_________________________________________________.$_____________________________________.$____________________________________________________.$__________________________________________________________________.$_______________________________________.$____________________________________________.$______________________________________________________.$_____________________________________________________________________.$_______.$_____________________________________________________________________.$__.$______.$_____________________________________________________________________.$___.$___.$_____________________________________________________________________.$___.$_____.$_____________________________________________________________________.$____.$____.$_____________________________________________________________________.$____.$_____.$_____________________________________________________________________.$____.$________.$_____________________________________________________________________.$____.$__________.$_____________________________________________________________________.$_____.$?.$_____________________________________________________________________.$_____.$___.$_____________________________________________________________________.$_____.$____.$_____________________________________________________________________.$_____.$_____.$_____________________________________________________________________.$_____.$______.$_____________________________________________________________________.$_____.$________.$______________________________________________________________________.$______________________________________________________________________.$_______.$?.$_____________________________________________________________________.$_______.$___.$_____________________________________________________________________.$_______.$_____.$______________________________________________________________________.$______________________________________________________________________.$__________.$?.$_____________________________________________________________________.$__________.$_____.$_____________________________________________________________________.$__________.$_______.$______________________________________________________________________.$______________________________________________________________________.$__.$___.$_____.$_____________________________________________________________________.$__.$___.$_______]& &$_________________________________________________________________

Try it online!

Explanation

Well, that was fun!

I think I've cracked this in a REALLY inefficient way, but the journey was fun. The hardest part here was also generating the lowercase letters. The main mechanism here is using ranges and getting the next element in the range. Since ( and ) aren't available and @ isn't available to store lists it's necessary to use [ and ] for array references. These can be stored like:

[$_=[$?..$=]]&[$__=$$_[//]]

In this, $_ contains a reference to an array containing a range from 0 ($?) to 60 ($=). Then $__ is set to the //th (1st) index of the dereferenced array $_ via $$_, which is one. Then the same process is repeated for the rest of the digits.

After getting the digits, the next item on my hitlist was the uppercase letters, which were acquired by using $_ which is an array reference (similar to my previous crack) so /./ would capture A in $&, then using the same reference mechanism as used for the digits, I create a range from A to _ and extract the 1st index, then do the same for B to _, etc.

To get the lowercase letters I was stumped for some time. I feel I was missing something fairly obvious, but when looking for a way to generate NaN or Inf, I read some documentation about $! which, when you store a number in it, returns the error string for that error number. I get "!" as "-"&"1", with "-" obtained from $#_ which is -1. In this code, I set $! to 4 which returns Interrupted system call. From here it's possible to extract a by storing $! in $_ and matching against /...$/ (which leaves all in $& and then juggling with $_ it's easy to get a and use the same approach used to get the uppercase with array references and dereferencing.

Once all the numbers and letters are available, it's easy to generate ' with g&"7" and call any methods we need. To output the string, the codepoints are mapped over with chr and passed as a list of args to print.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Oh, I hadn't thought of getting - from $#_, and from that !. $! was going to be my next trick to get lowercase letters without []. In this challenge, you missed a very simple way to get a lowercase letter: the same place you got an uppercase letter! [] stringified is ARRAY(0x...). I missed this one too for a while and tried to reach Inf, but then I realized it was there all along. \$\endgroup\$ – Gilles 'SO- stop being evil' Aug 2 at 23:32
  • \$\begingroup\$ I did get the x but wasn't able to get low enough in the alphabet to get what I needed... I must've missed something there! That was a journey though. I also redid $^X and the other control chars with stringwise AND, and looked at @INC but that all seemed too flakey! I'm gonna go back and check my work on x! \$\endgroup\$ – Dom Hastings Aug 3 at 5:19
  • \$\begingroup\$ Ahhhh, the last three chars appear to be consistent! Which would provide access to e... Is that what you had? \$\endgroup\$ – Dom Hastings Aug 3 at 5:39
  • 1
    \$\begingroup\$ $_ = "x"; $_ = [$_ .. $_ . $_]; $_ = $$_[3]; /./ gives you a from x \$\endgroup\$ – Gilles 'SO- stop being evil' Aug 3 at 8:38
  • \$\begingroup\$ Of course! How could I miss that! Hah! \$\endgroup\$ – Dom Hastings Aug 3 at 9:46
2
\$\begingroup\$

><>, cracks HighlyRadioactive's fourth answer

ii*:-ii*:ii*+:ii*+:ii*+:ii*+:ii*+:ii*+:ii*+:ii*+nnnnnnnnnnr'`'ii*+:ii*+:ii*+:ii*+:ii*+:ii*+'%'ii*+'k'ii*+'n'ii*+'k'ii*+'n'ii*+ii*ii*pv
> <                                                                                                                                 r<

Exits with an error, but when using the right interpreter (e.g. this), it's not actually output.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Still not intended... Why did I miss so many solutions? \$\endgroup\$ – null Aug 12 at 8:24
  • \$\begingroup\$ @HighlyRadioactive give up yet? \$\endgroup\$ – Lyxal Aug 12 at 8:25
  • \$\begingroup\$ No I'm gonna force you into a short solution \$\endgroup\$ – null Aug 12 at 8:26
  • \$\begingroup\$ @HighlyRadioactive alright then. Round 5 it is. \$\endgroup\$ – Lyxal Aug 12 at 8:26
  • \$\begingroup\$ This is record-breaking I believe... I have two solutions in round 5, so we'll have round 6 \$\endgroup\$ – null Aug 12 at 8:27
2
\$\begingroup\$

><>, -v 1, cracks HighlyRadioactive's sixth answer

:::-n:n::+n:::++n::::+++n:::::++++n::::::+++++n:::::::++++++n::::::::+++++++n:::::::::++++++++n:+:+:+:+:::::++++++:::,+:::,+:::,+:::,+:::,+::,:+:+:+:+:+::,+::,+::,+::,+::,+::,:::::::::+++++++++:*::,:::::::++++++++:::,::+++:::,:::::+++++-::,:+:+:+:+:+::,:++:::,::::+++++$::,::::::::::+++++++++:*::,::::::::::+++++++++++::,:pv
> <                                                                                                                                                                                                                                                                                                                              r~<

Try it online!

So guys, we did it. Funny thing is that I had the program cracked last night but I had to sleep before posting it.

Also, I'm starting to suspect there isn't actually a terse intended solution and that this is rather an excuse to make people write fish as if they're writing 1+. Gosh hecking dang it.

Oh, and one last thing: this crack and post was 100% written on my phone. That means I painstakingly hand typed all those colons, commas and plus signs.

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ +1 for doing all this on your phone. Let's HighlyRadioactive keeps the challenges coming - this is very entertaining \$\endgroup\$ – user Aug 12 at 23:17
  • 1
    \$\begingroup\$ "Also, I'm starting to suspect there isn't actually a terse intended solution and that this is rather an excuse to make people write fish as if they're writing 1+. Gosh hecking dang it." Nope - the previous ones do have a terse solution and I'll post it later. This is not part of my 1+ promotion. BTW, I realized this round is invalid (since you are required to point out the command line option in the cop) sorry. New challenge. \$\endgroup\$ – null Aug 13 at 1:51

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.