36
\$\begingroup\$

Inspired by this challenge, which got closed. This is meant to be an easier, but no less interesting version of that.

This is the cops thread of a challenge. For the robbers thread, see here.

Cops will provide a program/function and a flag. Robbers will try to guess a password such that, when the password is given to the cop's program, the flag is outputted.

Basic rules

  • The language used should be provided.
  • The flag, which can be an integer, string, or value of any other type, should be provided.
  • The flag may be printed to STDOUT, returned from a function, or outputted using any of the other standard output methods, as long as you specify how it will be outputted.
  • The program/function can take the password through STDIN, as a function argument, or using any of the other standard input methods, as long as you specify how the it will be inputted.
  • A free online compiler/interpreter should also be linked, preferably with the cop's code already pasted in and ready to run.

Some more rules

  • There must be at least one valid password that causes your program to return the flag, and you should know at least one of those passwords when posting your answer.
  • In case of a function submission, the cop should also include a full runnable program including the function either in the answer or in the linked online compiler/interpreter.
  • If it is at all ambiguous what the type of the flag is, it must be specified.
  • If a cop's description of the output is ambiguous (e.g. "HashSet(2, 1) should be printed"), robbers are allowed take advantage of that (e.g. print the string "HashSet(2, 1)" instead of an actual hashset)
  • Forcing robbers to simply brute force the password is not allowed.
  • The program must take input, and must output the flag when given the correct password. When not given the correct password, you are free to error, output something else, or immediately terminate. If your program never halts if given the wrong password, you must tell robbers of this behavior so no one waits around for the program to output something.

Cops's score will be the number of bytes their code takes up.

Cop answers will be safe if they haven't been cracked for two weeks.

Example

Cop:

Scala, 4 bytes

x=>x

Flag: Yay, you cracked it! (an object of type String is returned from the lambda above) Try it online!

Robber:

Password: the string "Yay, you cracked it!" Try it online!

Find Uncracked Cops

<script>site='meta.codegolf';postID=5686;isAnswer=false;QUESTION_ID=213962;</script><script src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'></script><script>jQuery(function(){var u='https://api.stackexchange.com/2.2/';if(isAnswer)u+='answers/'+postID+'?order=asc&sort=creation&site='+site+'&filter=!GeEyUcJFJeRCD';else u+='questions/'+postID+'?order=asc&sort=creation&site='+site+'&filter=!GeEyUcJFJO6t)';jQuery.get(u,function(b){function d(s){return jQuery('<textarea>').html(s).text()};function r(l){return new RegExp('<pre class="snippet-code-'+l+'\\b[^>]*><code>([\\s\\S]*?)</code></pre>')};b=b.items[0].body;var j=r('js').exec(b),c=r('css').exec(b),h=r('html').exec(b);if(c!==null)jQuery('head').append(jQuery('<style>').text(d(c[1])));if (h!==null)jQuery('body').append(d(h[1]));if(j!==null)jQuery('body').append(jQuery('<script>').text(d(j[1])))})})</script>

\$\endgroup\$
21
  • 6
    \$\begingroup\$ This is already explicitly mentioned in the challenge, but here is the meta post from Loopholes that are forbidden by default about using cryptographic functions in CnR challenges. \$\endgroup\$
    – Arnauld
    Oct 22 '20 at 17:56
  • 1
    \$\begingroup\$ May we specify multiple output formats at once; that is, specify that STDOUT must be a and STDERR must be b? \$\endgroup\$
    – hyper-neutrino
    Oct 22 '20 at 18:23
  • 4
    \$\begingroup\$ @SunnyMoon Sure, you can tell robbers that the password is a multiple of 34. Whether it's wise to leave robbers that clue, I don't know :) \$\endgroup\$
    – user
    Oct 22 '20 at 20:36
  • 4
    \$\begingroup\$ What is your definition of cryptographic functions? \$\endgroup\$ Oct 24 '20 at 12:08
  • 2
    \$\begingroup\$ This challenge seems to amount to just do cryptography without using cryptography. \$\endgroup\$
    – Wheat Wizard
    Oct 25 '20 at 12:09

63 Answers 63

16
\$\begingroup\$

PHP, 89 bytes, cracked by Benkerd22

<?php
$x=file_get_contents('php://stdin');
if(!preg_match('/.*golf.*/',$x))echo trim($x);

Try it online!

Outputs golf, exactly.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ I have a feeling this requires newlines \$\endgroup\$
    – user
    Oct 22 '20 at 22:57
  • \$\begingroup\$ I assume the intended output golf doesn't contain any hidden unprintables? I.e. this isn't valid? \$\endgroup\$ Oct 23 '20 at 8:56
  • 2
    \$\begingroup\$ @KevinCruijssen That's correct, there's no hidden characters. If you piped the output into xxd you would get precisely 67 6f 6c 66. \$\endgroup\$
    – Sisyphus
    Oct 23 '20 at 9:03
  • 2
    \$\begingroup\$ cracked! \$\endgroup\$
    – Benkerd22
    Oct 23 '20 at 15:16
13
\$\begingroup\$

Python 2, 94 bytes, cracked by Christian Mann

Edited to reduce score. See revision history for ungolfed version.

Another Python answer.

import re,sys
p=sys.stdin.read()
if re.match('^[exc\dhrkb\slim_=:;,.ants]*$',p):exec p;print a

Try it online!

Flag is 0xc0de. The output should be to STDOUT.


My solution was basically the same as Christian's:

The regex only accepts a very limited number of characters. Notable exclusions are all kinds of brackets, string delimiters, almost all operators and the p for print and input.
a='0xc0de' doesn't match the regex, and a=hex(49374) neither.

With these restriction I don't know of a way to call any function that returns a value. I would be interested in counterexamples ;).
One exception is a==b, which calls a.__eq__(b), but since q is not available, you can only do this with builtin types.

The idea is to use the fact that print a calls a.__str__ to get a string representation of the object a. This means we need to define an object a with a custom __str__ method, which is then called by string.
Instantiating objects is not possible without (), but luckily we can define methods on classes rather than instance objects using metaclasses.
The metaclass is required to have an __init__ function, that takes three arguments and returns None. A good choice for this is an __init__ function of a different class.

This result into the final solution:

class b:
    __str__ = 49374 .__hex__
    __init__ = 0 .__init__
class a:
    __metaclass__ = b

Try it online!

This doesn't work in Python 3 for two reasons:

  • int's dont have a __hex__ method anymore.
  • The syntax for metaclasses has changed. In Python 3 this would look like class a(metaclass=b): ..., which uses forbidden brackets
\$\endgroup\$
1
10
+100
\$\begingroup\$

R, 60 bytes, cracked by Paul

function(x) chartr("zyxwvu", "RRRRRR", tolower(x[1] + x[2]))

Try it online!

As in my previous challenge, the flag to output is the string "R". In other words, you need to find x such that f(x)=="R" is TRUE.


The solution is e.g. as.roman(c(2, 3)). This object is represented as c(II, III); it is of mode numeric but of class roman. Since it is numeric, addition works, giving the roman integer V. But since it is of class roman, tolower coerces it to string, giving the string "v". Then chartr translates this to "R".

\$\endgroup\$
15
  • \$\begingroup\$ What's the best way to write google queries about "R"? \$\endgroup\$ Oct 25 '20 at 9:38
  • 1
    \$\begingroup\$ @EricDuminil Often, including "R" in the search is enough. You can also include "CRAN" in the search (the Comprehensive R Archive Network), or search the r tag on SO: stackoverflow.com/questions/tagged/r \$\endgroup\$ Oct 25 '20 at 10:20
  • \$\begingroup\$ @Robin: I can crack this if I'm allowed to call the function twice (in which case, only the second call cracks it). Is that allowed (or what you intended...)? \$\endgroup\$ Oct 25 '20 at 17:29
  • 4
    \$\begingroup\$ Cracked! \$\endgroup\$
    – Paul
    Oct 26 '20 at 16:39
  • 2
    \$\begingroup\$ Wow! I had simply never heard of as.roman. Well done Paul. \$\endgroup\$ Oct 26 '20 at 16:55
9
\$\begingroup\$

Python 2.7, 189 bytes, cracked by ovs

import re

inp = raw_input()
if not re.match(r"^[\w\d=]*$", inp):
    quit()
exec(inp)

a = raw_input()
b = raw_input()
flag = a == b

if flag == True:
    print("%s %s"%(a, b))

Try it online!

Flag is The Flag, output to STDOUT. This might be a bit easy, but hopefully still fun!

\$\endgroup\$
2
  • \$\begingroup\$ cracked \$\endgroup\$
    – ovs
    Oct 22 '20 at 19:57
  • \$\begingroup\$ Nice! I knew it was too easy... \$\endgroup\$ Oct 22 '20 at 20:00
7
\$\begingroup\$

Haskell, 246 bytes, cracked by ovs

infix 0#
0:p#x=p#1:x
1:p#x:z=p#x:x:z
2:p#x:y:z=p#(y+x):z
3:p#x:y:z=p#(y-x):z
4:p#x:y:z=p#(y*x):z
5:p#x:y:z=p#div y x:z
6:p#x:y:z=p#y:x:y:z
7:p#x:y:z=p#y:x:z
c:p#x|(q,_:r)<-span(<c)p=r#until((==0).head)(q#)x
_#x=x
main=readLn>>=print.(#[]).take 60

Try it online!

Input is taken over STDIN, and output is printed to STDOUT. The flag is the output string: [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499]

(Those are the primes from 2 to 499.)

\$\endgroup\$
1
  • \$\begingroup\$ cracked. \$\endgroup\$
    – ovs
    Oct 24 '20 at 8:03
6
\$\begingroup\$

R, 29 bytes, cracked by pppery

function(x) intToUtf8(cos(x))

Try it online!

The flag to output is the string "R".


The solution is 5.1i.

Although \$\forall x\in\mathbb R, -1\leq\cos x\leq1\$, those bounds don't hold for complex \$x\$: \$\cos(a+ib)=\cos x\cosh y -i \sin x\sinh y\$, which is unbounded. We want to find \$x\$ such that \$ \cos x=82\$ (the ASCII codepoint of R); pppery gave the answer x=5.0998292455...i. The shorter x=5.1i works, because intToUtf8 can take a complex argument and cast is as integer by ignoring the imaginary part, and rounding down the real part to an integer.

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

Jelly, 4 bytes, cracked by Bubbler

OÆTP

Try it online!

Outputs 160.58880817718872.

¯\_(ツ)_/¯

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I got to 160.5888081771887... \$\endgroup\$
    – Bubbler
    Oct 23 '20 at 6:10
  • 2
    \$\begingroup\$ Cracked! \$\endgroup\$
    – Bubbler
    Oct 23 '20 at 6:22
6
\$\begingroup\$

05AB1E (legacy), 8 13 bytes, cracked by @ovs

F}žhм9£.ER.V*

+5 bytes to close a different crack found by @ovs (although he's free to post it as an actual crack instead if he chooses to).

Try it online.

Expected output: \n137438953472\n (where the \n are of course newlines).

Code explanation:

F              # Loop `N` in the range [0, input-1)
 }             # Close the loop
  žhм          # Remove all digits
     9£        # Only keep the first 9 characters
       .E      # Evaluate and execute as Python code
         R     # Reverse
          .V   # Evaluate and execute as 05AB1E (legacy) code
            *  # Multiply two values
               # (after which the result is output implicitly with a single trailing newline)

Tip 1: the program + intended solution only works in the legacy version of 05AB1E (built in Python 3) for two reasons. This won't work in the latest 05AB1E version (built in Elixir), where all these builtins as mentioned in the code explanation above will also act the same as described.
Tip 2: it won't time out on TIO, so an input like 274359834731, which would result in 137438953472\n (note it's missing the intended leading newline) isn't the intended solution, since the loop takes too long (no longer possible after the 5 bytes had been added). The intended solution runs in less than 0.2 seconds on TIO.
Tip 3: one of two reasons mentioned in tip 1 is a bug with .E and a certain type of input (which is ALSO in @ovs' initial crack), that I abuse to get the intended result.
Tip 4: there are three loose inputs (separated with newline delimiter), and the first and third inputs are the same

\$\endgroup\$
8
  • \$\begingroup\$ Are the quote marks (") part of the output? \$\endgroup\$
    – Sisyphus
    Oct 23 '20 at 10:32
  • 2
    \$\begingroup\$ I don't think this is the intended solution?! You might want to close that loophole \$\endgroup\$
    – ovs
    Oct 23 '20 at 10:41
  • \$\begingroup\$ @Sisyphus No, those are indeed not part of the output. I'll remove them. \$\endgroup\$ Oct 23 '20 at 11:45
  • \$\begingroup\$ @ovs Oh, that's another way to get the output, lol.. But indeed not the intended solution, albeit somewhat close in one aspect. If you want you can post it as a crack, I don't mind. I was expecting there would be more than one way to get the output apart from my intended solution. But if not, I've just edited my program to hopefully close that specific crack, and make it a bit harder to try a variation of that approach. I've also added a third tip. \$\endgroup\$ Oct 23 '20 at 12:07
  • 2
    \$\begingroup\$ I guess this was the intended solution? \$\endgroup\$
    – ovs
    Oct 23 '20 at 16:04
6
\$\begingroup\$

Wolfram Language (Mathematica), 15 bytes, cracked by w123

#//.a_:>Head@a&

(Edited to reduce byte count. Solution should be the same; all the unintended solutions I can think of should be trivial to adapt.)

Flag: flag.

Input by function argument, and output by return value. Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ cracked \$\endgroup\$
    – w123
    Oct 23 '20 at 9:46
6
\$\begingroup\$

Python 3.8 (pre-release), 93 bytes, cracked by pppery

from functools import*;lambda a,b,c:(d:=reduce)(lambda e,f:e[f],c,d(getattr,b,__import__(a)))

Try it online!

  • Input is function arguments, output is function return value.
  • Flag is the string pxeger (my username)

pppery didn't find my intended solution, and noone else has, but here it is:

The function

takes a module name to import, a list of attributes, and a list of indeces, and looks up a value. It is best explained with an example: ! f("spam_module", ["eggs", "ham"], [2, 3]) ! # ==> ! import spam_module ! spam_module.eggs.ham[2][3] !

Given that:

My username is regexp (as in Regular Expression), backwards, and regexp is quite a common variable name

So we need to:

  1. Find a use of the word regexp in the standard library

  2. Access it using Python's extensive runtime introspection API

  3. Reverse it

Specifically

In the csv module there is a class called Sniffer which has a method called _guess_quote_and_delimiter which uses a variable called regexp.

Python lets you

access that variable name as an element of the attribute .__code__.co_varnames. (I recommend looking into everything you can get from __code__ - it's very interesting, albeit excessive)

Then

regexp is the sixth variable name used there, so I lookup csv.Sniffer._guess_quote_and_delimiter.__code__.co_varnames[5]

Finally,

reverse that by slicing it with slice(None, None, -1) (equivalent to x[::-1])

So the whole solution is

f("csv",["Sniffer","_guess_quote_and_delimiter","__code__","co_varnames"],[5,slice(None,None,-1)])

\$\endgroup\$
3
  • \$\begingroup\$ You can ask me for hints in the Robbers' chatroom! \$\endgroup\$
    – pxeger
    Oct 24 '20 at 16:38
  • \$\begingroup\$ Cracked \$\endgroup\$ Oct 24 '20 at 16:49
  • 3
    \$\begingroup\$ Very clever challenge. It's almost a shame I spoiled it. \$\endgroup\$ Nov 1 '20 at 19:44
6
\$\begingroup\$

dotcomma, 819 bytes, cracked by the default.

[[,.][[,.],[.[[,.][.].]],.[[.,]]].,][,.]
[,],[[,.][[.][[[.][.].,][,.][.].,][[.][.
][.].,].[[[,.][[].[],.][[[,][,.].,]].,][
[,][.]].][,.][[,][[[,.][[[[.][.].,][,][.
][,][,.].,]].,].[[[,.][[[,][,.].,]][[].[
],].,][[,]].][,.][[,.][[[[.]][.][[[.][[.
]][[[[.]][[.][.][.].,][,.].,][.][,.].,][
,.][[.]].,][,.][.].,][[.]][,.].,][,.].][
.].,]][[.]].,]].,][,],[[[,.][.[[[,.][[].
[.],].,].][[,.][,.][,.].,]].,]][[,.].[.[
[.][,.].][[[[.][.][.][.].,][,.].,],][[[,
.][[[[[[[[[,][,.].,][,.].,][,][,.][.][.]
[.].,][.].,][.].,],],][.][.][.][.][.].,]
.,][.][.].,][,][,][,][,][,][,][[,.][[,][
,][,]].,][,][,][,][[,.][[,][,][,][,][,]]
.,][,][[,.][[[,.][[,]].,]].,][,]],.[[[,.
][[[[.][.][.].,][,][,][,.][[].[,],].,]].
,][[[,.][[[[[[[,.][.].,][.][.].,],][.].,
][.].,],].,][.][.][.][.].,][,][,][,][[,.
][[[,.][[,][,][,]].,]].,]]][.][[.]][[.]]

Try it online!

The flag is accepted.

Since this language is quite new and I've only seen two people (the inventor and me) using it so far, I tried to find a good balance between too hard and too easy.

If I've done it correctly, the code will have two valid passwords. The interpreter is written in Javascript and therefore runs on your local machine.

On my notebook it takes about five seconds to show "accepted" after entering the correct password.

Solution:

The intended solution is the number 49375. I initially wanted to use the decimal value of 0xC0DE (49374), but got things messed up in my head and ended up one number too high. The comparison function works in a way that the input and the solution are being decremented in a loop until one of them becomes zero. Then the other one must be 1 to be accepted. That means, 49376 is also a valid solution.

Other known solutions are [49375], [49376], [49375, -1] and [49376, -1]

The way this was meant to be cracked:

dotcomma is an esoteric language that is really hard to read, so I don't wanted anybody, to really "decompile" it and know exactly, what each command does, but to puzzle around with the blocks.

As already stated in my first comment, the language works a bit like Brain-Flak. The input will implicitly become the initial values in the queue and after the program ended, the content of the queue will implicitly be printed. So an empty program is a cat program.

To solve this, you first need to find the start and end of each block, what will result in something like this:

(1) [[,.][[,.],[.[[,.][.].]],.[[.,]]].,]
(2) [,.]
(3) [,],
(4) [[,.][[.][[[.][.].,][,.][.].,][[.][.][.].,].[[[,.][[].[],.][[[,][,.].,]].,][[,][.]].][,.][[,][[[,.][[[[.][.].,][,][.][,][,.].,]].,].[[[,.][[[,][,.].,]][[].[],].,][[,]].][,.][[,.][[[[.]][.][[[.][[.]][[[[.]][[.][.][.].,][,.].,][.][,.].,][,.][[.]].,][,.][.].,][[.]][,.].,][,.].][.].,]][[.]].,]].,]
(5) [,],
(6) [[[,.][.[[[,.][[].[.],].,].][[,.][,.][,.].,]].,]]
(7) [[,.].[.[[.][,.].][[[[.][.][.][.].,][,.].,],][[[,.][[[[[[[[[,][,.].,][,.].,][,][,.][.][.][.].,][.].,][.].,],],][.][.][.][.][.].,].,][.][.].,][,][,][,][,][,][,][[,.][[,][,][,]].,][,][,][,][[,.][[,][,][,][,][,]].,][,][[,.][[[,.][[,]].,]].,][,]],.[[[,.][[[[.][.][.].,][,][,][,.][[].[,],].,]].,][[[,.][[[[[[[,.][.].,][.][.].,],][.].,][.].,],].,][.][.][.][.].,][,][,][,][[,.][[[,.][[,][,][,]].,]].,]]]
(8) [.]
(9) [[.]]
(10) [[.]]

Then try out, what each block does.

Block 1 (filter): This block actually answers the default.'s question (sorry, I didn't answer it clearly. No other submission had to answer details about the password, and the "wrong password :(" was the only red herring I added to the program. So I didn't want to say "No, it's actually a five digit integer"). If you run that with different data types (numbers, strings, lists of numbers or strings), you will see that it returns the first element of a string or list, if it has multiple elements, or it will return a 1 and the element, if you enter a number or a string/list with only a single letter in it. The purpose of this becomes clear, if you add the second block to it.

Block 2 (delete first element): If you run blocks 1 and 2, you will see that the output will be empty if you input anything with multiple values. Only single numbers or single letters will remain in the queue. (Actually the default. found a bug in the programming language, because negative values should not be possible in the queue. You can't programmatically write a negative value onto the queue, and negative values won't be written to the output, but apparently they still can be read from input). So from this point, it should be clear that the password is either a number or a single letter.

Block 3 (run next block, if there's something in the queue): This will not change the output, but is there for control. You can ignore it.

Block 4 (build constants for comparison): This will build the list [49375, 96, input]. At this point, you may ask yourself, what the big number is for and that it may be important for the password.

Block 5 (run next block, if there's something in the queue): Same as block 3. Since there are three values in the queue, this will also rotate the queue, so the output is [96, input, 49375].

Block 6 (compare input and password): As stated earlier, this decrements the input and the number 49375, until one of them becomes zero. Then decrements the other another time and appends the 96 to it. The output is [49375-input (or input-49376), 96]. At this point, you should point out that you have to change the input in a way that the first value becomes something interesting, like 0, -1 or maybe 96?

Block 7 (write output): This block checks if the first value is 0. If so, it uses the second value to build the string "accepted". If not, it fills the queue with the string "rejected".

Blocks 8-10: Those are just fillers, so my submission will have a nice rectangle shape.

\$\endgroup\$
5
  • \$\begingroup\$ Is the password a string? \$\endgroup\$ Oct 26 '20 at 12:49
  • \$\begingroup\$ I think, it would become too easy if I told you details about the password. The format is one of the formats that are recommended by the interpreter website (a plain number or a string or a list containing only numbers or strings). A little hint: The language is a bit like Brain-Flak. At the start, the input is written into the queue and at the end, the queue is written to stdout. So you can run fragments of the code and find patterns in the output. The nesting level will help you \$\endgroup\$
    – Dorian
    Oct 26 '20 at 13:33
  • \$\begingroup\$ @thedefault. As far as I have read, dotcomma only supports integers. \$\endgroup\$
    – SunnyMoon
    Oct 27 '20 at 13:45
  • 2
    \$\begingroup\$ @SunnyMoon: If you want to say "It doesn't support floating point number types", you're right. If you want to say "It doesn't support strings", you're wrong (the output "rejected" or "accepted" already is a string). Strings in the input are split into their characters and their codepoints are written into a queue of BigIntegers. If you enter an integer, it will become the only value in the queue of BigIntegers. Depending on the selected output type, it will either print the values of the queue or try to translate the values to their unicode codepoints and build a string from that. \$\endgroup\$
    – Dorian
    Oct 27 '20 at 15:29
  • \$\begingroup\$ Cracked \$\endgroup\$ Nov 1 '20 at 7:23
5
\$\begingroup\$

Python 3, 85 bytes, cracked by r3mainer

import re,time
b=input()[:40]
a=time.time()
re.match(b,b)
if time.time()-a>9:print(0)

Try it online!

Prints 0. Works on TIO.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Cracked \$\endgroup\$
    – r3mainer
    Oct 23 '20 at 0:03
  • \$\begingroup\$ I'm not sure if this is completely valid, since theoretically, I could have a computer which no 40-char regex could occupy for longer than 9 seconds. \$\endgroup\$
    – Makonede
    Feb 17 '21 at 19:35
5
\$\begingroup\$

Arn, 19 bytes, cracked by r3mainer

€weL˜ù┼󪘛’U•žfcmº

I would provide the unpacked form, but it's rather trivial to decode adds to the challenge if you have to decode it yourself. Not terribly difficult, but it requires you to access the source code. The flag you want is:

7.9228162514264337593543950336e+28

this was done in the online interpreter. This shouldn't be too difficult, and multiple inputs should theoretically work. However, I encourage you to try and figure out the one I used (you will know immediately if you found the right one).

Solution + Explanation

The flag r3mainer used was J0e_Biden!. The flag I intended to be the solution will remain hidden, as to encourage others to try :). However, to make it easier, here is an explanation for the program :*:*((|:(|\):}):i0^:i"n

:* Square
  :* Square
      ( Begin expression
        (
            |: Bifurcate*
              (
                |\ Fold with concatenation (remove spaces)
                  _ Variable initialized to STDIN; implied
              ) End expression
          :} Tail
        )
      :i Index of
        0 Literal zero
    ^ To the power of
        _ Implied
      :i
        "n" literal string
  • Note: bifurcate is currently broken, and this program takes advantage of that. Basically, |:(...):} is a synonym for reversing the string ... (don't you love bugs?)
\$\endgroup\$
2
  • 1
    \$\begingroup\$ This appears to be the unpacked code: :*:*((|:(|\):}):i0^:i"n. \$\endgroup\$
    – Sisyphus
    Oct 24 '20 at 1:32
  • 1
    \$\begingroup\$ Cracked \$\endgroup\$
    – r3mainer
    Oct 26 '20 at 10:59
5
\$\begingroup\$

I'll get things started off with one that probably won't be extremely difficult but may take some thought.

Python 3, 78 bytes: cracked by wastl

while 1:
	try:l=input()
	except:l=''
	exec(l,{},{"exit":0,"quit":0})
	print(1)

Try it online!

Flag is nothing. As in, . The program should not output anything.

\$\endgroup\$
7
  • \$\begingroup\$ cracked \$\endgroup\$
    – Noodle9
    Oct 22 '20 at 18:19
  • \$\begingroup\$ @Noodle9 Not the solution I expected or would've figured out but very nice job! Unfortunately seems someone beat you to it on the robbers' thread side. \$\endgroup\$
    – hyper-neutrino
    Oct 22 '20 at 18:20
  • \$\begingroup\$ Oh, you already saw it. Was about to comment. \$\endgroup\$
    – wastl
    Oct 22 '20 at 18:21
  • 1
    \$\begingroup\$ Another solution, with nothing to STDERR: Try it online! \$\endgroup\$
    – xnor
    Oct 22 '20 at 19:50
  • 1
    \$\begingroup\$ @pxeger break wouldn't work because exec doesn't get the context of being with a while loop. however, it would cause an error, which would prevent any output to STDOUT, which was an oversight on my part cuz you can just do anything that causes an error. I should've specified that STDOUT and STDERR should both be blank. My intended solution was actually globals()['__builtins__']['exit'](), though del exit;exit() works too. \$\endgroup\$
    – hyper-neutrino
    Oct 24 '20 at 14:26
4
\$\begingroup\$

Perl 5 (-n), 33 bytes, Cracked by Neil

length()<28 && !/\w/ && eval eval

Try it online!

The flag is Flag. The input is stdin and output stdout.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ cracked \$\endgroup\$
    – Neil
    Oct 22 '20 at 22:26
  • \$\begingroup\$ that was it, i thought it wouldn't be too difficult for a perl hacker :) \$\endgroup\$ Oct 23 '20 at 6:37
4
\$\begingroup\$

JavaScript (SpiderMonkey), 23 bytes, Cracked by Sisyphus

a=readline()
print(a+a)

Try it online!

  • Expect output: aaa
  • Input / Output use stdin, stdout
\$\endgroup\$
1
4
\$\begingroup\$

!@#$%^&*()_+, 104 bytes, cracked by @thedefault

*^(%  _+*^)%(0_+%)%  _+^$($_^_$_^_$+!!!!!!!!!+++++++++^$)+_^_  _+$(_^^^^^^^^^^_$^$)+xx_+$(_0+_$^$)+!!@@@

The flag to this program is $$$ output to STDOUT.

I guarantee that the flag will appear in at least 5 seconds given the correct password.

Try it online!

What does it even do?

*^(%  _+*^)%(0_+%)%  _+^$($_^_$_^_$+!!!!!!!!!  # Push the password integer...
+++++++++^$)+_^_  _+$(_^^^^^^^^^^_$^$)+        # ...from STDIN onto the stack
xx_+$(_0+_$^$)+                                # Divide by the ASCII value of 0 i.e 48
!!@@@                                          # Print the result as a character thrice.

Therefore:

\$x = 48 · 36 = 1728\$

Where x is the password.

FYI 36 is the ASCII value of $.

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

Ruby -n, 32 bytes, cracked by @Sisyphus

Edit to reduce score by 1: (p eval$_)p(eval$_).

!/[Scfpv\.:\?'"%<`(]/&&p(eval$_)

Input via STDIN. Flag is """\n (three double-quote characters with trailing newline) printed to STDOUT.

\$\endgroup\$
2
  • \$\begingroup\$ Cracked. I guess unintended. \$\endgroup\$
    – Sisyphus
    Oct 25 '20 at 6:00
  • \$\begingroup\$ @Sisyphus Indeed! Time for a rethink. \$\endgroup\$
    – Dingus
    Oct 25 '20 at 6:03
4
\$\begingroup\$

Ruby, 85 bytes, cracked twice by the-default

x=gets
puts (x[0...n=x.size/2].to_i*x[n..-1].to_i).to_s(36) if x[-9..-1]=="123456789"

Try it online!

Flag is: codegolfguessmypasswordrobber001qtr5vxskd64lddb0gsyw2w4hp8zd1t0j, as a string, in STDOUT.

Explanation

Two prime numbers have been chosen, each having 50 decimal digits. One of them ends with "0123456789", and their product begins with codegolfguessmypasswordrobber when written in base 36.

p = 91642145128772682907542781226248344977333099146327
q = 15416260853069873976599113800182718102190123456789
n = p*q = 1412779214440046356547554449820888121475969772090456386542605159205021769559275444371360154172564003

This looks like an RSA factoring challenge, and factorizing the semi-prime is definitely one way to find the password. Bruteforce was explicitly forbidden for this challenge, though. And apparently, it wasn't too hard anyway to factorize n with an open-source program called cado-nfs. I should probably have picked a longer semiprime, e.g. RSA-200.

There's a (badly hidden) backdoor : String#to_i is happy to convert any string to an integer.

Extraneous characters past the end of a valid number are ignored.

So "1x000123456789".to_i gets converted to 1, and the challenge becomes trivial. It's now possible to "factorize" n as n*1.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Cracked \$\endgroup\$ Oct 25 '20 at 4:12
  • 3
    \$\begingroup\$ Downvoter : constructive criticism is welcome. My post follows every rule above, and doesn't use any loophole. \$\endgroup\$ Oct 25 '20 at 14:27
4
\$\begingroup\$

Python 3.7, 84 bytes, Cracked

Takes Python code as input from input from stdin. The code is only executed if it consists of a subset of the characters of '\n ,.:;=@_abcdefijlmnoprstvz' and the keyword class occurs at most two times.

c=open(0).read()
{*c}<{*'\n ,.:;=@_abcdefijlmnoprstvz'}!=3>c.count('class')!=exec(c)

Try it online! (on 3.7.4)

The flag is -1025 (printed to STDOUT).

My intended solution:

@print
@int.__invert__
@object.__sizeof__
class o:__slots__=__name__,__name__,__name__,__name__
Try it online!

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

JavaScript (V8), 26 bytes, cracked by emanresu A

Seemed like a cool challenge, so here's an easy one.

Pass any JS value into the function. Flag is true printed to stdout. (boolean, not string.) If there is any other output apart from true is considered not cracked.

x=>console.log({}[x][x]())

Try it online!

Intended solution:

{v: 0, toString() {Object.prototype.f = () => true; return this.v++ ? "f" : "valueOf"}}

This works because:

{}[x] calls the toString method of x

valueOf returns the original object

Therefore, modifying the Object prototype to add a method f in the toString method of x, returning "valueOf" the first time and "f" the second time does the trick

\$\endgroup\$
4
  • \$\begingroup\$ Cracked \$\endgroup\$
    – emanresu A
    Sep 14 '21 at 12:05
  • \$\begingroup\$ Oh. I never even thought of modifying prototypes :p \$\endgroup\$
    – emanresu A
    Sep 14 '21 at 12:27
  • \$\begingroup\$ @emanresuA My reasoning was that you got 3/4 of the way there (self modification using tostring) so reposting a patched submission is like reposting 1/4 of the original problem \$\endgroup\$ Sep 14 '21 at 12:31
  • \$\begingroup\$ No, I used {}["constructor"]["is"], basically Object.is, which returns truthy when called with no arguments. \$\endgroup\$
    – emanresu A
    Sep 14 '21 at 12:32
4
\$\begingroup\$

Stable Rust 1.52.1, 171 bytes

fn u<T:'static>(_:T){use std::any::*;let _=unsafe{(1 as*mut T).read_volatile()};let a=type_name::<T>();print!("{}",&a[41..]=="(((), ()), ((), ()))>"&&a.contains("&dyn"))}

Playground

Entering the right password will print true and won't segfault (or print anything to stderr). This relies on implementation-defined behavior, so this will only probably work on different versions of Rust.

Password: u::<fn(&dyn std::any::Any)->(((),()),((),()))>.

Explanation:

There are probably other valid passwords but this is the intended one. The function is generic over all 'static types so you can put in almost anything into the function. However, most types will immediately segfault- unsafe{(1 as*mut T).read_volatile()} is a volatile read of address 1. However, not everything will segfault- in Rust, types with a size of zero can be read from any well-aligned non-null pointer, and most zero-sized types have an alignment of one.

This brings me to the second safeguard: parsing the type name. This is the implementation-defined part- the type_name function is only guaranteed to be a best-effort description of the type. The type name was chosen to be particularly difficult to find a zero-sized type to match. The solution I have uses a particular monomorphization of the function I submitted to pass the criteria. It is likely possible to define another type that meets the criteria. Ungolfed code with solution entered.

\$\endgroup\$
2
  • \$\begingroup\$ You are already safe but we still have no ideas what the password is. \$\endgroup\$
    – user100411
    Sep 17 '21 at 2:10
  • \$\begingroup\$ @nrgmsbki4spot1 oops I forgot about this. Solution and explanation added. \$\endgroup\$
    – Aiden4
    Sep 17 '21 at 4:18
4
\$\begingroup\$

Vyxal, 31 bytes (safe)

I.dI:⅛kF*×u⅛Ė.SṪḢ42f÷₍+*Π¾J∑Cøṙ

Try it Online!

Flag: EEEEEEEEEEEEEEEEEEEEEEEE Flag should be printed to STDOUT.

Under the original specifications for this cop, okie had a clever crack here, but that was an unintentional crack, so a couple clarifications are in order.

  • The input will not contain any subset of the flag.

  • The program should not return any errors.

Intended Solution: 21⅛3 Try it Online!

Before execution, Vyxal attempts to execute the input and see what it returns. The reason for this is to allow you to do things like input a list in Vyxal format, and it will work as intended. This also allows you to put Vyxal code in the input, but normally it will just get captured as a string. For example, and input of 69d:e would just input the string 69d:e.

However, if you put a number at the end of that input, it only captures that number as input, and discards all of the code leading up to it. For example, an input of 69d:e2 would input the number 2, and discard the 69d:e.

In the discarded code, trying to assign variables and functions doesn't do anything, nor does assigning to the global register, since those are in a different scope from the main program. However, the global array is global, and persists after the input execution. In the solution, 21⅛3 pushes 21 to the global array, then inputs 3.

Now let's go through the program step-by-step.

.dI:⅛ - Push 1 to the global array and to the stack

kF* - Multiply FizzBuzz by the 1 on the stack

u⅛ - Push -1 to the global array

× Ė - Multiply the FizzBuzz by the inputted 3 to get FizzBuzzFizzBuzzFizzBuzz

.SṪḢ - Push .

42f÷₍+*Π - Push 48

¾J∑ - Concatenate the global array and the 48 and add. We used the input to push 21 to the global array, so this comes out to 69.

C - Convert to character to get E

øṙ - Regex replace: In string FizzBuzzFizzBuzzFizzBuzz, replace with E anything matching the regex .

\$\endgroup\$
16
  • 3
    \$\begingroup\$ Welp, time to learn Vyxal \$\endgroup\$
    – Mayube
    Nov 18 '21 at 19:40
  • \$\begingroup\$ I feel like the solution to this is to somehow get a function onto the stack to change the behavior of øṙ but I definitely don't understand Vyxal well enough to crack it \$\endgroup\$
    – Mayube
    Nov 18 '21 at 20:26
  • \$\begingroup\$ @Mayube That's a possibility. Who knows? Mayube, mayube not. :P \$\endgroup\$ Nov 18 '21 at 21:22
  • 2
    \$\begingroup\$ @okie Oh, that's clever! However, that's not the intended solution. I suppose I should specify that the the flag won't be in the input, and there won't be any errors. \$\endgroup\$ Nov 23 '21 at 13:35
  • 2
    \$\begingroup\$ @okie It still works on the lyxal.pythonanywhere.com site, but not on the new vyxal.pythonanywhere.com site. Lyxal.pa is running Vyxal 2.4, whereas vyxal.pa is running 2.6. The TIO link in the post links to the correct site. \$\endgroup\$ Dec 1 '21 at 0:05
4
\$\begingroup\$

JavaScript, 57 bytes, cracked by Conor O'Brien

alert("xx".split(new RegExp(p=prompt())).join``.length>2)

The flag is true.

https://xkcd.com/2217/

\$\endgroup\$
5
  • \$\begingroup\$ May I ask why this doesn't work as a function? \$\endgroup\$
    – user
    Dec 7 '21 at 1:28
  • \$\begingroup\$ TIO in case anyone wants to try it out, although I don't know if it works without alert or prompt. \$\endgroup\$
    – user
    Dec 7 '21 at 1:36
  • \$\begingroup\$ @rues If it was a function, someone could crack it with (Array.prototype.join=()=>"aaaa",""). (hence my earlier inquiry) \$\endgroup\$
    – tjjfvi
    Dec 7 '21 at 2:00
  • \$\begingroup\$ And yes, my intended crack works on that TIO (though the version in the answer is normative) \$\endgroup\$
    – tjjfvi
    Dec 7 '21 at 2:01
  • \$\begingroup\$ Cracked. \$\endgroup\$ Dec 7 '21 at 3:06
4
\$\begingroup\$

JavaScript (ES6), 117 bytes, cracked by @tjjfvi

_=>{c=prompt();if(/[^!-'*-Za-z]/.test(c))throw'CHEATER!';x=(o=>o(o.a,o.b,o.c,o.d))((0,eval)(c));return(x===x&&x!==x)}

The function must be called without arguments. The password must be provided via prompt(), and the return value of the function must be true (boolean). Otherwise logging true to the console is not acceptable. You may only use language features as specified in the ES6 standard, using platform-dependent APIs is forbidden.

You can test your passwords here:

f=_=>{c=prompt();if(/[^!-'*-Za-z]/.test(c))throw'CHEATER!';x=(o=>o(o.a,o.b,o.c,o.d))((0,eval)(c));return(x===x&&x!==x)}

console.log(f())

I really hope I managed to filter out all passwords other than the intended one :D

\$\endgroup\$
8
  • \$\begingroup\$ Did you mean something like x==x&&x!=x? \$\endgroup\$
    – tjjfvi
    Dec 7 '21 at 22:00
  • \$\begingroup\$ @tjjfvi Nope. It's strict equality on purpose. And yes, it has a solution. \$\endgroup\$
    – FZs
    Dec 7 '21 at 22:08
  • \$\begingroup\$ Are you sure? :P \$\endgroup\$
    – tjjfvi
    Dec 7 '21 at 23:56
  • \$\begingroup\$ @tjjfvi Yes, tried before posting (and now too). I love JavaScript because of such things. That's supposed to be a tough challenge, and looks like it's working. Good luck with it! \$\endgroup\$
    – FZs
    Dec 8 '21 at 5:48
  • \$\begingroup\$ Result of the intended password \$\endgroup\$
    – FZs
    Dec 8 '21 at 5:54
3
\$\begingroup\$

JavaScript (V8), 25 bytes, Cracked by user

y=s=>(l=s.length)?l:l/l|1

Try it online!

The flag is 0.
Input: function parameter.
Output: returned value of function.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ By the way, I think you should say that it's an integer, otherwise you'd be leaving yourself vulnerable to cracks like this \$\endgroup\$
    – user
    Oct 22 '20 at 21:00
  • 1
    \$\begingroup\$ Actually that was the crack I had in mind. Suppose it wasn't as hard as I was thinking it would be. \$\endgroup\$
    – Scott
    Oct 22 '20 at 21:14
  • 1
    \$\begingroup\$ Mind if I post my own answer on the robbers thread? \$\endgroup\$
    – user
    Oct 22 '20 at 21:14
3
\$\begingroup\$

Python 3.8, 95 bytes, cracked by wastl

import os;(c:=os.getenv("A")).isidentifier()and c not in"printinput"and eval(c)(os.getenv("B"))

Input is via environment variables. (no TIO link because it doesn't support them). Flag is the_flag.

@wastl did not find my intended solution - theirs was much simpler. Here is what I indended:

PYTHONBREAKPOINT=builtins.print A=breakpoint B=the_flag python -c 'import os;(c:=os.getenv("A")).isidentifier()and c!="print"and eval(c)(os.getenv("B"))'

The PYTHONBREAKPOINT environment variable describes a function to be called when you use breakpoint(). Python has a lot of weird implicit behaviours like this. I intentionally left "input is environment variables" vague so you would think it would only be A and B

\$\endgroup\$
4
  • \$\begingroup\$ Is output to STDERR fine? \$\endgroup\$
    – ovs
    Oct 22 '20 at 20:12
  • \$\begingroup\$ Please include how the_flag will be outputted \$\endgroup\$
    – user
    Oct 22 '20 at 20:17
  • 1
    \$\begingroup\$ (initially edited, but now I'm not sure if it's equivalent) does this work as a test link for someone writing a solution? \$\endgroup\$
    – hyper-neutrino
    Oct 22 '20 at 20:36
  • 1
    \$\begingroup\$ cracked: codegolf.stackexchange.com/a/213974/78123 \$\endgroup\$
    – wastl
    Oct 22 '20 at 20:39
3
\$\begingroup\$

><>, 4 bytes

i10p

Try it online!

The flag is Something smells delicious... printed to STDOUT, and takes input form STDIN.
Invalid keys may not always terminate the program.

Not a difficult one, but I like this feature.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ cracked \$\endgroup\$
    – ovs
    Oct 23 '20 at 15:31
3
\$\begingroup\$

JavaScript, 10428 bytes, cracked by ovs

[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(+(!+[]+!+[]+!+[]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([]+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][([][[]]+[])[+!+[]]+(![]+[])[+!+[]]+((+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]]](!+[]+!+[]+!+[]+[!+[]+!+[]])+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]])()([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]]+(([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]]+[+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+[+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+[+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+[+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+[+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]]+[+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+([][[]]+[])[!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+[+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]]+[+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]]+[+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+[+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]]+[+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]]+[+!+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+[+!+[]]+(+(+!+[]+[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[!+[]+!+[]]+[+[]])+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+[+[]]+[!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+[+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+[+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]]+[+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+[+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+([][[]]+[])[!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]]+[+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]+(!![]+[])[+[]]+[!+[]+!+[]+!+[]+!+[]+!+[]]+[+!+[]])[(![]+[])[!+[]+!+[]+!+[]]+(+(!+[]+!+[]+[+!+[]]+[+!+[]]))[(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([]+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]][([][[]]+[])[+!+[]]+(![]+[])[+!+[]]+((+[])[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]+[])[+!+[]+[+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]]](!+[]+!+[]+!+[]+[+!+[]])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]]((!![]+[])[+[]])[([][(!![]+[])[!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([![]]+[][[]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]](([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((!![]+[])[+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+!+[]]+(![]+[+[]])[([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()[+!+[]+[+[]]]+![]+(![]+[+[]])[([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()[+!+[]+[+[]]])()[([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]((![]+[+[]])[([![]]+[][[]])[+!+[]+[+[]]]+(!![]+[])[+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+([![]]+[][[]])[+!+[]+[+[]]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[!+[]+!+[]+!+[]]]()[+!+[]+[+[]]])+[])[+!+[]])+([]+[])[(![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(!![]+[])[+[]]+([][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]]+(!![]+[])[+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]]()[+!+[]+[!+[]+!+[]]])())

Because no one said there was a character limit :)

Fiddle

The flag is cracked! otherwise there is no output.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ I suppose it's too late to add a character limit now :/ \$\endgroup\$
    – user
    Oct 23 '20 at 18:46
  • 1
    \$\begingroup\$ So is this just jsf*ck? \$\endgroup\$
    – user
    Oct 23 '20 at 18:59
  • 1
    \$\begingroup\$ cracked. \$\endgroup\$
    – ovs
    Oct 23 '20 at 21:11
3
\$\begingroup\$

JavaScript, 2465 bytes, cracked by the default.

X=([...O],S=[])=>{let M,F,a,b,R,n;M=F=0;while(O.length)eval(("?S.shift())#[a,b]!2);F=a==b;?a-b)#M++#?M)#%#M=0#M=%#R=%O=[]#n=%n!n);if(F)O=n.concat(O)".split`#`[O.shift()]||"").replace(/%/g,"S.pop();").replace(/\?/g,"S.push(").replace(/!/g,"=S.splice(-"));return R};const U=prompt().split``.map(e => e.charCodeAt()).join``.replace(/9/g,"").split("").map(e=>+e);R={s:20,m:0x80000000,a:1103515245,c:12345,get q(){return R.s=(R.a*R.s*+R.c)%R.m},i(v){return R.q/~-R.m*v|0},get b(){return R.i(2)},h([...a]){for(i=~-a.length;i>0;i--){j=R.i(i+1);[a[i],a[j]]=[a[j],a[i]]}return a}};R.s=U.reduce((p,c)=>p+c,0);class S{constructor(w,n=0){this.w=w;this.n=n;this.s={};this.c={}}N(T=this){return new S(T.w,T.n)}P(T=this){for(let i=0;i<T.w;i++)if(!T.c[i])T.A(i,T.n++);return T}M(s,t,T=this){let A=T.c[s],B=T.c[t];T.s[A]=T.s[A]||[];T.s[B]=T.s[B]||[];T.s[A].push(...T.s[B]);T.s[B].map(c=>{T.c[c]=A});delete T.s[B]}S(a,b,T=this){return T.c[a]==T.c[b]}A(c,s,T=this){T.c[c]=s+="";T.s[s]=T.s[s]||[];T.s[s].push(c)}*[Symbol.iterator](){yield*Object.entries(this.s)}Z(f=false,T=this){let C,b,c,v,N,r,g,l,m;C=[];b=[c=0];for(;c<~-T.w;c++){if(T.S(c,c+1)||(!f&&R.b)){C.push(b);b=[c+1]}else{T.M(c,c+1);b.push(c+1)}}C.push(b);v=[];N=T.N();if(!f){for(let[i,s]of T){let q=R.i(s.length-1);if(!q)q++;g=R.h(s).slice(0,q);v.push(...g);g.map(c=>N.A(c,i))}}r=[];C.map(c=>c.map((e,i,a)=>{l=i+1==a.length;m=!l*2;m|=1*(v.indexOf(e)!==-1);r.push(m)}));return[N.P(),r]}static F(w=10,h=10){let s=new S(w).P(),r,g=[[1]],i=0;for(;i<w;i++)g[0].push(1,1);for(let i=0;i<h;i++){[s,r]=s.Z(i===h-1);g.push(...I(r))}return g}};let I=(r, last=false)=>{let D=[1],E=[1];r.map(c=>{D.push(0,+((c&2)==0));E.push(+((c&1)==0),1)});return[D,E]};class B{constructor(w=10,h=10){this.m=S.F(w,h);this.r=0;this.G=true;this.f()}a(x=this.x,y=this.y){return this.m[y][x]}f(T=this){T.x=T.y=T.ey=1;while(T.a()!=0)T.x++;T.ex=this.m[0].length-1;while(T.a(T.ex)!=0)T.ex--}W(){return this.x==this.ex&&this.y==this.ey}d(r=this.r){return [[0,1],[-1,0],[0,-1],[1,0]][r]}L(){this.r++;this.r%=4}F(){let o=this.x,p=this.y,d=this.d();this.x+=d[0];this.y+=d[1];if(this.a()==1){this.x=o;this.y=p;this.G=false}if(this.W()){console.log("win");this.G=false}}M(r){r=this.r+r;r%=4;let m=-1,d=this.d(r),x=this.x,y=this.y;while(this.a(x,y)!=1){x+=d[0];y+=d[1];m++}return m}T(f){let ms=[1,3,0,2],v=f(ms.map(e=>this.M(e)));while(v&&this.G){this["KLFK"[v%4]].bind(this)();v>>=2}return this.G}R(f){let Y=999;while(this.G&&Y-->0)this.T(f)}}(new B()).R(a=>X(U,a))

Try it online! The flag is win. There should be no other output produced by the program. Although I designed this program to work with Firefox's implementation of JavaScript, it also works on node, hence the link. Input is a string through prompt, which is substituted for a command line argument in the header of the node TIO link.

There is very much method in this madness; brute force is neither recommended nor viable, hopefully. Slightly golfed. More so an attempt to make it to 2 weeks, than doing it with the lowest score possible—a proof of concept, if you will.

Or, try it here, in your browser

X=([...O],S=[])=>{let M,F,a,b,R,n;M=F=0;while(O.length)eval(("?S.shift())#[a,b]!2);F=a==b;?a-b)#M++#?M)#%#M=0#M=%#R=%O=[]#n=%n!n);if(F)O=n.concat(O)".split`#`[O.shift()]||"").replace(/%/g,"S.pop();").replace(/\?/g,"S.push(").replace(/!/g,"=S.splice(-"));return R};const U=prompt().split``.map(e => e.charCodeAt()).join``.replace(/9/g,"").split("").map(e=>+e);R={s:20,m:0x80000000,a:1103515245,c:12345,get q(){return R.s=(R.a*R.s*+R.c)%R.m},i(v){return R.q/~-R.m*v|0},get b(){return R.i(2)},h([...a]){for(i=~-a.length;i>0;i--){j=R.i(i+1);[a[i],a[j]]=[a[j],a[i]]}return a}};R.s=U.reduce((p,c)=>p+c,0);class S{constructor(w,n=0){this.w=w;this.n=n;this.s={};this.c={}}N(T=this){return new S(T.w,T.n)}P(T=this){for(let i=0;i<T.w;i++)if(!T.c[i])T.A(i,T.n++);return T}M(s,t,T=this){let A=T.c[s],B=T.c[t];T.s[A]=T.s[A]||[];T.s[B]=T.s[B]||[];T.s[A].push(...T.s[B]);T.s[B].map(c=>{T.c[c]=A});delete T.s[B]}S(a,b,T=this){return T.c[a]==T.c[b]}A(c,s,T=this){T.c[c]=s+="";T.s[s]=T.s[s]||[];T.s[s].push(c)}*[Symbol.iterator](){yield*Object.entries(this.s)}Z(f=false,T=this){let C,b,c,v,N,r,g,l,m;C=[];b=[c=0];for(;c<~-T.w;c++){if(T.S(c,c+1)||(!f&&R.b)){C.push(b);b=[c+1]}else{T.M(c,c+1);b.push(c+1)}}C.push(b);v=[];N=T.N();if(!f){for(let[i,s]of T){let q=R.i(s.length-1);if(!q)q++;g=R.h(s).slice(0,q);v.push(...g);g.map(c=>N.A(c,i))}}r=[];C.map(c=>c.map((e,i,a)=>{l=i+1==a.length;m=!l*2;m|=1*(v.indexOf(e)!==-1);r.push(m)}));return[N.P(),r]}static F(w=10,h=10){let s=new S(w).P(),r,g=[[1]],i=0;for(;i<w;i++)g[0].push(1,1);for(let i=0;i<h;i++){[s,r]=s.Z(i===h-1);g.push(...I(r))}return g}};let I=(r, last=false)=>{let D=[1],E=[1];r.map(c=>{D.push(0,+((c&2)==0));E.push(+((c&1)==0),1)});return[D,E]};class B{constructor(w=10,h=10){this.m=S.F(w,h);this.r=0;this.G=true;this.f()}a(x=this.x,y=this.y){return this.m[y][x]}f(T=this){T.x=T.y=T.ey=1;while(T.a()!=0)T.x++;T.ex=this.m[0].length-1;while(T.a(T.ex)!=0)T.ex--}W(){return this.x==this.ex&&this.y==this.ey}d(r=this.r){return [[0,1],[-1,0],[0,-1],[1,0]][r]}L(){this.r++;this.r%=4}F(){let o=this.x,p=this.y,d=this.d();this.x+=d[0];this.y+=d[1];if(this.a()==1){this.x=o;this.y=p;this.G=false}if(this.W()){console.log("win");this.G=false}}M(r){r=this.r+r;r%=4;let m=-1,d=this.d(r),x=this.x,y=this.y;while(this.a(x,y)!=1){x+=d[0];y+=d[1];m++}return m}T(f){let ms=[1,3,0,2],v=f(ms.map(e=>this.M(e)));while(v&&this.G){this["KLFK"[v%4]].bind(this)();v>>=2}return this.G}R(f){let Y=999;while(this.G&&Y-->0)this.T(f)}}(new B()).R(a=>X(U,a))

Intended solution

the default.'s solution was very close to being exactly the same as mine, and in fact, conceptually equal to mine. However, mine has a bit tighter encoding:

Z5[_\\#\]:#][4\]!!!!\]\\\\ \\\]:(Z5[_\\#\]:#][4\] \\\]4\\\]:4\\\\\\\\\\\\\\\\\\\\%

I'll probably released a half-golfed, half-annotated version of the source later.

\$\endgroup\$
1

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.