34
\$\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
  • 3
    \$\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 '20 at 3:22

97 Answers 97

4
\$\begingroup\$

Java, cracks MCross's answer

class Puzzle {
  public static void main(String[] args) throws Throwable {
    try (AutoCloseable a = new Throwable() {
        {
            setStackTrace(new StackTraceElement[0]);
        }
        @Override
        public String toString() {
            return "" + (char)(46) + (char)(92);
        }
    }::printStackTrace) {}    
  }
}

All the credit goes to @nthistle, who found this resource, which I shamelessly copied.

It uses a method reference to override AutoCloseable's close method, which gets invoked at the end of a try-with-resources block. The toString method contains the actual message, and the setStackTrace part ensures it doesn't print the actual stacktrace afterwards.

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

JavaScript (Browser) (3709 bytes), cracks @Sparkles the Unicorn's answer

-693 bytes thanks to Bubbler's suggestion to use String.fromCharCode only once

console.log(String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[]))+String.fromCharCode(((+!+[])+(+!+[])+(+!+[])+(+!+[]))*([+!+[]]+[+[]])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])+(+!+[])))

Try it online!

No numbers? No problem! Also, note the suspicious lack of C and S in the output string. This immediately clued me in to String.fromCharCode – the only problem is how to produce numbers, since all number literals are banned. Fortunately, JavaScript has some really awful type juggling, so you can produce the number 3, for instance, like (+!+[])+(+!+[])+(+!+[]).

In practice, as long as ()+[]! are all allowed, you can just use JSFuck to convert the whole thing, but it really inflates the size (the version of my answer wouldn't fit in this post), and no C and S made me assume that String.fromCharCode was the intended solution anyways. I did borrow the literals for 1 and 10 in order to construct my character codes, though.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I think you could make it shorter by using String.fromCharCode only once, as it can take multiple values at once (TIO). \$\endgroup\$ – Bubbler Jul 27 '20 at 23:43
  • 1
    \$\begingroup\$ Oh neat, I didn't know that. I updated the answer, but it's definitely nowhere close to optimal -- I have tons of extra parentheses floating around, and there's shorter ways to express say, 65, than (1+1+1+1+1+1)*(10)+(1+1+1+1+1). \$\endgroup\$ – nthistle Jul 28 '20 at 0:11
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).

\$\endgroup\$
5
  • \$\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 '20 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 '20 at 19:02
  • \$\begingroup\$ The output is : (, not (. \$\endgroup\$ – Gilles 'SO- stop being evil' Jul 30 '20 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 '20 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 '20 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.

\$\endgroup\$
1
  • \$\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 '20 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]]
\$\endgroup\$
3
  • \$\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 '20 at 3:01
  • \$\begingroup\$ A simpler answer. \$\endgroup\$ – Razetime Aug 21 '20 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 '20 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.

\$\endgroup\$
1
  • \$\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 '20 at 18:47
4
\$\begingroup\$

Python 3, 8065 bytes, Cracks M Virts' third answer

print(f'''{chr(len('ccccccccc'))}{chr(len('cccccccccc'))}{chr(len('ccccccccccc'))}{chr(len('cccccccccccc'))}{chr(len('ccccccccccccc'))}{chr(len('cccccccccccccc'))}{chr(len('ccccccccccccccc'))}{chr(len('cccccccccccccccc'))}{chr(len('ccccccccccccccccc'))}{chr(len('cccccccccccccccccc'))}{chr(len('ccccccccccccccccccc'))}{chr(len('cccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}{chr(len('ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'))}''')

Try it online!

Pretty self-explanatory. chr(len('')) is used to convert the length of an arbitrary string to its ASCII character, and f-strings are used to join them.

\$\endgroup\$
2
  • \$\begingroup\$ Nice! Almost cracked, if you take out the new lines in your code it will be good to go. Works just like the original \$\endgroup\$ – M Virts Jan 29 at 3:48
  • \$\begingroup\$ Haha oh wait there are only new lines in the tio code! Good enough for me \$\endgroup\$ – M Virts Jan 29 at 3:50
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.

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

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

\$\endgroup\$
1
  • \$\begingroup\$ Very nice! Pretty similar to what I had. \$\endgroup\$ – DLosc Jul 29 '20 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!

\$\endgroup\$
1
  • 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 '20 at 9:21
3
\$\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.

\$\endgroup\$
2
  • 3
    \$\begingroup\$ All's fair in code golf and war ;) \$\endgroup\$ – Dingus Aug 1 '20 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 '20 at 16:51
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.

\$\endgroup\$
3
  • \$\begingroup\$ Hurray finally someone to crack my answer!! \$\endgroup\$ – null Aug 1 '20 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 '20 at 6:24
  • \$\begingroup\$ @HighlyRadioactive Because it wasn't well tested :). Fixed. \$\endgroup\$ – Dingus Aug 1 '20 at 7:22
3
\$\begingroup\$

PHP 7, 46 bytes, cracks thelmuxkriovar's second answer

<?php echo"      crACked??"^"FUNTIMK[:>4XKcA";

Try it online!

\$\endgroup\$
3
  • \$\begingroup\$ you're too fast lol, good job, this was similar to the solution I initially came up with \$\endgroup\$ – thelmuxkriovar Aug 19 '20 at 9:12
  • \$\begingroup\$ @thelmuxkriovar Yeah, apologies! I think I was there at the right time and had alraedy prepared the other answer when I looked at your first :) \$\endgroup\$ – Dom Hastings Aug 19 '20 at 9:18
  • 1
    \$\begingroup\$ 25 seconds from cop to crack - must be a record! \$\endgroup\$ – Dingus Aug 21 '20 at 5:06
3
\$\begingroup\$

Lua, 5152 bytes, cracks @LuaNoob's fourth answer

io[([[write]])](string[string[([[gsub]])]([[chAr]],[[A]],string[([[sub]])](_VERSION,string[([[find]])]([[ccA]],[[A]]),string[([[find]])]([[ccA]],[[A]])))](string[([[find]])]([[ccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),string[([[find]])]([[ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccA]],[[A]]),tostring(string[([[find]])]([[cccccccccA]],[[A]]))))

Try it online! Works in both 5.1 (as required) and 5.3.5 (the version on TIO).

It looks like my crack for the third challenge in the series was unnecessarily convoluted. It's taken me all this time to realise that _G/getfenv() aren't even needed: string itself is a table!

As in the previous challenges, we need to create the string char. We start with chAr and replace the A with a, which is extracted as the third character of _VERSION, a global string that returns Lua 5.1 in 5.1. Once this is done, we simply pass in a list of the required ASCII codes, generated using string[([[find]])] to return the index of the first occurrence of the letter A in strings of the form ccc...A. For reasons I don't understand, the last ASCII code has to be passed to tostring or else the last character gets printed twice.

\$\endgroup\$
2
  • \$\begingroup\$ Is this even Lua at this point? 🤣 \$\endgroup\$ – EasyasPi Feb 13 at 3:26
  • \$\begingroup\$ Good Job :D Im out of Ideas for now. About string, you can even do ([[]])[([[gsub]])] \$\endgroup\$ – LuaNoob Feb 13 at 17:00
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!

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

\$\endgroup\$
7
  • \$\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 '20 at 17:25
  • \$\begingroup\$ You could always add & and ~ to the banned character list and try again. \$\endgroup\$ – pppery Jul 26 '20 at 17:26
  • \$\begingroup\$ I think banning & would be more useful than @, but sure, I'll post it. \$\endgroup\$ – Ethan Chapman Jul 26 '20 at 17:28
  • \$\begingroup\$ Yes, that was a typo on my part. \$\endgroup\$ – pppery Jul 26 '20 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 '20 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.

\$\endgroup\$
3
  • \$\begingroup\$ May you give a documentation link about what ` does in Python2, please? \$\endgroup\$ – Ekrem Dinçel Jul 26 '20 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 '20 at 23:00
  • \$\begingroup\$ thanks, I know repr. I only know Python3.x and this syntax seems ugly. \$\endgroup\$ – Ekrem Dinçel Jul 27 '20 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 -/+.

\$\endgroup\$
2
  • \$\begingroup\$ Well done, beautiful solution! I didn't know about apropos until today. \$\endgroup\$ – Robin Ryder Jul 26 '20 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 '20 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.

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

\$\endgroup\$
1
  • \$\begingroup\$ Nice work! Definitely not what I intended, so I'll add a couple more exclusions and try again! \$\endgroup\$ – Dom Hastings Jul 27 '20 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)))
\$\endgroup\$
6
  • 1
    \$\begingroup\$ Nice. I had this before seeing you had already cracked it! \$\endgroup\$ – Giuseppe Jul 27 '20 at 12:26
  • 1
    \$\begingroup\$ @Giuseppe It looks like apropos is becoming your tool of choice! \$\endgroup\$ – Robin Ryder Jul 27 '20 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 '20 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 '20 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 '20 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!

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

\$\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.
\$\endgroup\$
2
  • \$\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 '20 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 '20 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!

\$\endgroup\$
2
  • \$\begingroup\$ Not the intended solution. Didn't block capital letters, whoops. \$\endgroup\$ – att Jul 28 '20 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 '20 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!

\$\endgroup\$
1
  • \$\begingroup\$ I had several ways to crack it, but didn't really think of using file I/O. Nice job. \$\endgroup\$ – Bubbler Jul 28 '20 at 23:24
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.

\$\endgroup\$
4
  • 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 '20 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 '20 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 '20 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 '20 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 (>>).

\$\endgroup\$
2
  • 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 '20 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 '20 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).

\$\endgroup\$
1
  • \$\begingroup\$ Well done. Bang on with the approach. \$\endgroup\$ – Dingus Aug 2 '20 at 4:06

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.