Will it halt? (Robbers)

46

2

This is the robbers' thread. The cops' thread is here.

Your challenge is to crack a cop's submission by finding an input that makes it halt. You don't have to find out why, or all inputs that make it halt if there's more than one, or the input the cop intended, just one input will do.

Once you have cracked a submission, post a link to it in a comment or edit to the cop's post. You can also flag your submission for a mod to edit it in the cop's post. Also, post the input used and a link to the cop's post in an answer in this thread. The robber that cracks the most submissions wins.

Multiple people can post cracks to the same cop submission, as long as they are different.

(If SE converted your duplicate answer to a comment, you may want to vote on this feature request)


Looking for uncracked submissions?

fetch("https://api.stackexchange.com/2.2/questions/135363/answers?order=desc&sort=activity&site=codegolf&filter=!.Fjs-H6J36vlFcdkRGfButLhYEngU&key=kAc8QIHB*IqJDUFcjEF1KA((&pagesize=100").then(x=>x.json()).then(data=>{var res = data.items.filter(i=>!i.body_markdown.toLowerCase().includes("cracked")).map(x=>{const matched = /^ ?##? ?(?:(?:(?:\[|<a href ?= ?".*?">)([^\]]+)(?:\]|<\/a>)(?:[\(\[][a-z0-9/:\.]+[\]\)])?)|([^, ]+)).*[^\d](\d+) ?\[?(?:(?:byte|block|codel)s?)(?:\](?:\(.+\))?)? ?(?:\(?(?!no[nt][ -]competing)\)?)?/gim.exec(x.body_markdown);if(!matched){return;}return {link: x.link, lang: matched[1] || matched[2], owner: x.owner}}).filter(Boolean).forEach(ans=>{var tr = document.createElement("tr");var add = (lang, link)=>{var td = document.createElement("td");var a = document.createElement("a");a.innerText = lang;a.href = link;td.appendChild(a);tr.appendChild(td);};add(ans.lang, ans.link);add(ans.owner.display_name, ans.owner.link);document.querySelector("tbody").appendChild(tr);});});
<html><body><h1>Uncracked Submissions</h1><table><thead><tr><th>Language</th><th>Author</th></tr></thead><tbody></tbody></table></body></html>

programmer5000

Posted 2017-07-24T15:48:37.750

Reputation: 7 828

2Does different mean different inputs (say, all inputs ending with 2 crack the cop's post - can you different people post different numbers ending in 2?) or different families of inputs, or different types of inputs? – Stephen – 2017-07-24T17:03:54.213

1Multiple people can post cracks to the same cop submission... Please define different. – Dennis – 2017-07-25T13:41:59.717

@NoOneIsHere https://codegolf.meta.stackexchange.com/q/13437/58826

– programmer5000 – 2017-07-25T15:26:04.653

Answers

50

Malbolge, Doorknob

Try it online (Thanks Dennis!)

Input for Windows: F_⌠1234567890

Input on Linux based system using ISO-8559-1: F_ô1234567890

The heart of how the Malbolge program worked is that it depended on a behavior of the Malbolge interpreter which causes an infinite loop if it encounters any instruction which is not between 33 and 126. The program was constructed such that your input would allow you to modify a single instruction.

I modified the interpreter to dump the program memory state at the beginning of execution and to also produce 'normalized' source code which takes the form of a list of op codes that will be run during the execution of the program. With that information you could (slowly) determine that even though the program took 13 inputs only the 1st and 3rd inputs actually mattered.

Looking through the normalized code and memory dump (and a touch of debugger help) I devised the following:

a = op(input 1, 29524)

b = op(input 3, a)

c = op(486, b)

d = op(c, 37)

e = d/4 + d%3 * 3^9

e must be between 33 and 126

Where op is the so called tritwise "op" that is described in the specification. Using this information you can write a simple program which iterates over the possible inputs (0 to 255) and finds all solutions which meet the above criteria. I had found 2219 possible solutions, some of which will probably not be working solutions (you can't input the required characters). Specifically the above inputs are based on the solution:

(Input 1 = 70, Input 3 = 244)

KBRON111

Posted 2017-07-24T15:48:37.750

Reputation: 561

I don't have the rep to comment cracked on the cops post. Could someone do that for me? – KBRON111 – 2017-07-27T02:23:17.840

4Welcome to PPCG! Good job! I think with this crack, you'll soon have enough rep :) – Stephen – 2017-07-27T02:33:32.010

1I commented across. And yes, excellent work; I was half expecting Malbolge to last the week! – Veedrac – 2017-07-27T02:34:44.193

I might need to remove this answer. I just tried using GCC and it looks like it isn't working. It looks like the memory address is different on my system. I will investigate it more tomorrow. – KBRON111 – 2017-07-27T03:01:37.207

Nevermind, it looks like it was an encoding issue. I will add more details when I come back to explain my reasoning. – KBRON111 – 2017-07-27T04:47:27.787

I am impressed. Well done. :) Will edit an explanation of the original thought process behind the design into my submission eventually. – Doorknob – 2017-07-27T12:26:33.050

1Now I can sleep again – Juan Tonina - Reinstate Monica – 2017-07-27T12:58:02.247

Hey! Would you consider putting your modified Malbolge interpreter on Github? – Stephen – 2017-07-31T14:43:06.507

Sure, here you go https://github.com/KBRON111/Modified-Malbolge-Interpreter

– KBRON111 – 2017-08-03T01:33:11.707

16

JavaScript (in Browser)

document.all

This is falsy, surprisingly

Edit: why is document.all falsy?

Juan Tonina - Reinstate Monica

Posted 2017-07-24T15:48:37.750

Reputation: 459

4I'm speechless. – Dennis – 2017-07-25T16:34:40.767

3Aahh... javascript, where everything is weird – Juan Tonina - Reinstate Monica – 2017-07-25T16:36:43.427

1Yes! That's the only correct answer here! – tsh – 2017-07-26T01:33:10.923

13

JS (ES6), Juan Tonina

+0,-0

Took a bit of looking in Object.is to find. Basically, +0 === -0 since === checks them as numbers, and 0 is finite, but Object.is sees +0 and -0 as different objects. Very smart cop :)

Try it online!

Stephen

Posted 2017-07-24T15:48:37.750

Reputation: 12 293

Ninja got it while I was logging in. Shoot. – user3033745 – 2017-07-24T16:59:31.157

Damn, solved faster than the time I spent thinking about the code :D – Juan Tonina - Reinstate Monica – 2017-07-24T17:02:08.687

11

Python, Siphor

class A:
    i = True
    def __eq__(self, a):
        self.i = not self.i
        return self.i

a = A()
f(a)

We just redefine equality to behave exactly as required to get the program to terminate.

Gavin S. Yancey

Posted 2017-07-24T15:48:37.750

Reputation: 617

Although I suppose I could have just defined __eq__ to raise... – Gavin S. Yancey – 2017-07-24T21:35:36.930

I was about to submit with just returning 0 :p – Jonathan Allan – 2017-07-24T21:40:08.167

@JonathanAllan How does that work? – Gavin S. Yancey – 2017-07-24T21:41:17.877

1Pretty sure just class A:__eq__=lambda s,o:0 and f(A()) does the job. – Jonathan Allan – 2017-07-24T21:41:24.453

1Ah yeah need the negation >_< – Jonathan Allan – 2017-07-24T21:42:06.080

FYI it's not Eric's submission it's Siphor's. – Jonathan Allan – 2017-07-24T21:56:19.673

@JonathanAllan Oops...edited. I think I was reading from the answer below or above it or something... – Gavin S. Yancey – 2017-07-24T21:57:39.400

8

Braingolf

-1

Any number less than 0 works.

Try it Online!

programmer5000

Posted 2017-07-24T15:48:37.750

Reputation: 7 828

8

PHP, Sisyphus

(-0[0)> deal with it=1

The parse_str function changes the spaces and other characters to underscores. If you put a [ used for Array delimiter without closing, it changes it to an underscore but has the effect of not translating the following spaces (I don't know why).

Try it online!

Vicente Gallur Valero

Posted 2017-07-24T15:48:37.750

Reputation: 201

WTF?! That is insane... – Veedrac – 2017-07-25T16:49:39.940

7

JavaScript (Node.js), Adnan

[] and [] seem to work. I tried a bunch of them including null, undefined, NaN...

[] >= [] && [] <= [] && [] != [] evaluates to true.

Moral of the story: JavaScript is weird.

Try it online!

totallyhuman

Posted 2017-07-24T15:48:37.750

Reputation: 15 378

Yep, arrays are just objects. – programmer5000 – 2017-07-24T18:05:36.467

And objects are cast to strings for these types of comparisons. – Conor O'Brien – 2017-07-24T20:49:21.630

7

JavaScript (ES7), Arnauld

Standard

"8e7" is solution

var crack_me = (x=0)=>{for(;~x/x.length**3!=-2962963;);}

var key = "8e7"

crack_me(key)
console.log("stopped :)")

Hack

No need to calculate this number, we can redefine length property

This sets ~x/x.length**3!=-2962963 to false

var crack_me = (x=0)=>{for(;~x/x.length**3!=-2962963;);}

var key = {toString:()=>"2962962",length:"1"}

crack_me(key)
console.log("stopped :)")

Operators priority

~ bitwise not is first

** exponentiation second

/ division third

Евгений Новиков

Posted 2017-07-24T15:48:37.750

Reputation: 987

6

Bash, Veedrac

LD_TRACE_LOADED_OBJECTS

Try it online!

From the ld.so(8) manpage:

LD_TRACE_LOADED_OBJECTS

If set (to any value), causes the program to list its dynamic dependencies, as if run by ldd(1), instead of running normally.

Sisyphus

Posted 2017-07-24T15:48:37.750

Reputation: 1 521

I thought this would last longer! Excellent work. – Veedrac – 2017-07-25T13:09:21.640

1@Veedrac: I guess since you specified bash, it's unlikely that you'd find a statically-linked (e.g. busybox?) /bin/yes, but that is possible, in which case this env var would be ignored. – Peter Cordes – 2017-07-27T10:35:52.360

6

Mathematica, JungHwan Min

Unevaluated@Throw@"hammertime"

No clue whether this is the intended solution, but it passes in an expression that doesn't get evaluated until it's referenced as # inside the function, which will cause it turn return from the function immediately without doing any further evaluation. You can see that the function is actually called (instead of just throwing the exception before even invoking the function) by changing the function to:

#0[Print@"stop";#;$IterationLimit=∞]&

Which will indeed print the stop before throwing the error.

Martin Ender

Posted 2017-07-24T15:48:37.750

Reputation: 184 808

Bingo! (I was actually going for Unevaluated[Abort[]], but same thing.) – JungHwan Min – 2017-07-25T15:29:21.157

5

Retina, PunPun1000

11111

Try it online!

Any input with n 1s where the sum of the divisors of n+1 is equal to n+1 should work.

user41805

Posted 2017-07-24T15:48:37.750

Reputation: 16 320

Nice to see someone get the intended solution – PunPun1000 – 2017-07-24T16:52:06.543

5

Ruby

exit

without newline. 3.send('exit') surely isn't equal to 5, but it executes Kernel#exit:

Initiates the termination of the Ruby script by raising the SystemExit exception

It's possible to call exit on 3 because:

The Kernel module is included by class Object, so its methods are available in every Ruby object [as private methods].

abort also works:

Terminate execution immediately, effectively by calling Kernel.exit(false). If msg is given, it is written to STDERR prior to terminating.

Eric Duminil

Posted 2017-07-24T15:48:37.750

Reputation: 701

5

JavaScript (Node.js), programmer5000

Already cracked, but mine is slightly different :) Don't have enough rep to comment over in the cops. Also feel free to edit to fix formatting, my first post here.

Mainly I set __proto__ equal to a function that throws. Taken from looking at the Mozilla page for proto. (Sorry, low rep, can't post a link.)

x = {}
let No = function () { throw 'halted' }
x.__proto__ = new No()
f = x=>{while(x.__proto__);}

Try it online!

EDIT: Got some rep, so here's the link: Mozilla __proto__

Haumed Rahmani

Posted 2017-07-24T15:48:37.750

Reputation: 141

I commented on the cop for you. – Stephen – 2017-07-24T23:03:02.040

1Thanks! Also thanks all for the ups, guess I can comment now! – Haumed Rahmani – 2017-07-24T23:15:31.840

1Welcome to PPCG :D – Conor O'Brien – 2017-07-24T23:22:16.593

5

Bash, Sisyphus

kill 0

Fortunately, kill is a shell builtin.

Try it online!

Dennis

Posted 2017-07-24T15:48:37.750

Reputation: 196 637

5

Javascript, programmer5000

Max string length

Uses a string with a length one less than what your engine supports. When adding "h" to this string, an error is thrown. Try it online!

function getAlmostMaxLenStr() {
  var prevBases = [];
  var base = "a";
  try {
    while(true) {
      prevBases.push(base);
      base += base;
    }
  } catch(e) {}
  for (var i = prevBases.length-1; i>=0; --i) {
    try {
      base += prevBases[i];
    } catch (e) {}
  }
  return base;
}
f(getAlmostMaxLenStr());

Cross-origin block

Heavily inspired by the answer from @jadkik94, but works everywhere. Creates a cross-origin iframe, then passes the .contentWindow of said iframe. This fails when the function tries to use the value due to cross-origin safety.

let f=x=>{
  try {
    console.log(x+"h"); // we don't want to lock up your browser, do we ;)
  } catch (e) { console.log("Halted!\n",e); }
}
let iframe=document.createElement("iframe");
const url = location.host.indexOf("google") === -1 ? "https://google.com" : "https://stackexchange.com";
iframe.src=url;
iframe.onload=a=>f(iframe.contentWindow);
document.body.appendChild(iframe);

Primitive value

Variant of the .toString() answers - this just uses toPrimitive instead. It returns an object as the primitive value, which Javascript doesn't know how to handle (so it throws an error). Try it online!

f({
  [Symbol.toPrimitive](){return {}}
});

Birjolaxew

Posted 2017-07-24T15:48:37.750

Reputation: 323

Nice job, but still not intended solution! Very clever! – programmer5000 – 2017-07-25T11:30:36.643

5

R, Jarko Dubbeldam

function(x)if(is.list(x))return(1)

First time contributing anything, so do call out any mistakes I've made in format.

Pretty sure this is valid. Just a rewrapping of is.list(), right?

CriminallyVulgar

Posted 2017-07-24T15:48:37.750

Reputation: 501

Incidentally, I don't have the rep to comment on the original so a hand would be appreciated if it's valid. – CriminallyVulgar – 2017-07-27T12:59:26.340

Commented for you. – TheLethalCoder – 2017-07-27T13:02:06.720

Not the intended solution, but works. Good job. – JAD – 2017-07-27T13:04:55.933

4

Node.js, Adnan

{} and {} or any 2 objects are the two inputs. I don't even understand how this works.

Here's JS's amazing object compare logics:

console.log({} == {});
console.log({} === {});
console.log({} > {});
console.log({} < {});
console.log(!!{});

console.log({} >= {});
console.log({} <= {});

programmer5000

Posted 2017-07-24T15:48:37.750

Reputation: 7 828

Yup, that was the intended solution :) – Adnan – 2017-07-24T18:04:12.813

4

Octave, Stewie Griffin

Input: exit

Reasoning: input evalutes whatever is input. exit exits the program.

Try it online!

OlivierTheOlive

Posted 2017-07-24T15:48:37.750

Reputation: 161

4

Javascript (NOT node.js), programmer5000

This can't be added because it creates an object that has no toString because a new Set does not inherent prototypes from from Object.

input:

new Set()

Try it online!

Grant Davis

Posted 2017-07-24T15:48:37.750

Reputation: 693

This was probably the intended solution, I'll keep that in the bag of my head from now on :P – Stephen – 2017-07-24T20:29:27.320

Sorry this doesn't seem to work for me? Try it online!

– Haumed Rahmani – 2017-07-25T01:04:42.917

@HaumedRahmani added a try online button. I used spider monkey, not babel. – Grant Davis – 2017-07-25T01:40:36.770

Not the intended solution, but nice job! – programmer5000 – 2017-07-25T01:49:44.850

4

JavaScript (Babel Node), Conor O'Brien

(Repost, accidentally put in cops.) Not sure what was intended but positive decimals that aren't enormous all seem to work.

Also I guess I still can't comment in Cops.

f(0.1)
console.log('done')

Try it online!

Haumed Rahmani

Posted 2017-07-24T15:48:37.750

Reputation: 141

Forgot about that as well, good one. – Conor O'Brien – 2017-07-24T23:48:55.800

4

Python 2, Foon

__import__("os")._exit(0)

What it says on the tin, basically.

Try it online.

Veedrac

Posted 2017-07-24T15:48:37.750

Reputation: 711

Interestingly enough, on TIO this times out for me; under Windows (specifically with winpty python inputbad.py and pasting in the line), it does exit as desired... and yeah, not surprisingly my schtict was exploiting the "input under Python 2 does eval under the hood" bit – Foon – 2017-07-25T11:01:23.757

@Foon Hmm, it's working fine on TIO for me. See link in answer. – Veedrac – 2017-07-25T11:18:47.330

Weird... I must have hit play and then typed input on my TIO link and not realized it – Foon – 2017-07-25T13:42:50.413

I'm pretty sure this cracks every python submission.. – enderland – 2017-07-26T03:13:45.317

@enderland Only if they evaluate your input, which most of them don't. – Veedrac – 2017-07-26T03:26:08.303

4

Bash 4.2, Dennis

PATH=1

Clearly not the intended solution, because it works on newer bash as well.

Try it online.

Veedrac

Posted 2017-07-24T15:48:37.750

Reputation: 711

4

Python 3 (CPython), Veedrac

a=('',(type,),{})
X=type(*a)(*a)
X.__class__=X

Try it online!

ecatmur

Posted 2017-07-24T15:48:37.750

Reputation: 1 675

4

Python 3, Siphor

This was fun. We need to make the type(x) != str check pass, so we need to control the return value of type(). We have to override the __class__ attribute and replace it with a custom object, that extends type, which has the __ne__ method replaced by one that always returns false. This makes it pass the type check, but the search will fail because o is not a str.

class m(type):
    def __ne__(a,b):
        return False
class c:pass
o=c()
o.__class__=m("",(c,),{})
f(o)

ebopalisesy

Posted 2017-07-24T15:48:37.750

Reputation: 43

Welcome to the site! :) – James – 2017-07-25T21:01:47.087

4

C#, TheLethalCoder

System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]

Or any other nullable class.

Luc

Posted 2017-07-24T15:48:37.750

Reputation: 191

3

JavaScript (ES6), programmer5000

"\0"

Try it online!

The condition was !x||x>="\n". Any single char in an ASCII table with a code less than \n will work.

Stephen

Posted 2017-07-24T15:48:37.750

Reputation: 12 293

Yes, I thought this was it, wasn't sure... – tuskiomi – 2017-07-24T16:27:10.200

3

JS (ES6)

"   "

Any character with a code less than 10 should work; I've used a tab character above, which SE converts to spaces.

Shaggy

Posted 2017-07-24T15:48:37.750

Reputation: 24 623

Ninja'd – programmer5000 – 2017-07-24T16:26:39.537

Sorry :( plus I think you'd need quotes around it for it to be a string – Stephen – 2017-07-24T16:27:04.817

@programmer5000, so I see :( – Shaggy – 2017-07-24T16:27:06.410

No problem, @StepHen; nature of the game. I took the quotes to be implicit, but I'll edit them in. – Shaggy – 2017-07-24T16:27:51.907

@Shaggy I dunno what the ruling is, but f(<tab>) is valid syntax (empty input) and we'd have to differentiate between f(1) and f("1") anyway – Stephen – 2017-07-24T16:30:15.397

3

Retina

A newline followed by a 1 works. I found it right away.


1

Try it online

mbomb007

Posted 2017-07-24T15:48:37.750

Reputation: 21 944

Ninja'd by a minute – user41805 – 2017-07-24T16:33:02.870

@Cowsquack The question says multiple cracks for the same cop post are allowed. – mbomb007 – 2017-07-24T16:40:11.357

I knew I should have removed newlines from the input as a first step – PunPun1000 – 2017-07-24T16:46:12.073

3

MATL, Luis Mendo (not the intended solution)

The empty input stops the program and thorws the following error:

input: reading user-input failed!

Try it online!

Mr. Xcoder

Posted 2017-07-24T15:48:37.750

Reputation: 39 774

3

cQuents, Step Hen

Anything followed by a space and a positive integer. The space separates inputs, and the extra input becomes the number of the term to output.

Try it online!

PurkkaKoodari

Posted 2017-07-24T15:48:37.750

Reputation: 16 699

I was just about to post a 1! You ninja'd me :/ – Mr. Xcoder – 2017-07-24T17:12:19.367

@Mr.Xcoder I typed this on mobile, hoping that nobody would ninja me :P – PurkkaKoodari – 2017-07-24T17:13:52.080

3

MATL, Luis Mendo

0/0

MATL evaluates 0/0 as NaN. Since NaN != NaN it does not loop

Try it online!

PunPun1000

Posted 2017-07-24T15:48:37.750

Reputation: 973

3

Octave, Stewie Griffin

Any undefined input such as a will work: Try it online!

Defined values would not work, because | in a while environment is short-circuiting, so when it sees 1, it will already become true, no matter what the value of x is. So, the only way to make it halt is to make x=input('') halt, i.e. by giving it undefined inputs.

Leaky Nun

Posted 2017-07-24T15:48:37.750

Reputation: 45 011

+1 for teaching me that | short-circuits in while environments – Luis Mendo – 2017-07-27T15:22:11.293

3

Javascript (NOT node.js)

Feel like this is cheating based on the last answer...

{toString:_=>{throw''}}

Dom Hastings

Posted 2017-07-24T15:48:37.750

Reputation: 16 415

1IMO this is perfectly fine :) – Stephen – 2017-07-24T19:53:42.053

3

C (gcc), dj0wns

%s%s

Try It Online!

The offending command essentially evaluates to this and throws a seg fault when it tries to read a second string from beyond d, since there is no 5th argument to the function.

char b[256];
char*d = "abcd";
snprintf(b,4,"%s%s",d)

PunPun1000

Posted 2017-07-24T15:48:37.750

Reputation: 973

Not my intended solution but I guess it works on Tio, doesn't work on my local machine though. – dj0wns – 2017-07-24T19:59:43.860

I hope someone can find the intended solution then, this particular question allows for multiple cracks – PunPun1000 – 2017-07-24T20:00:45.953

Well done mate! – dj0wns – 2017-07-24T20:01:28.373

C is perfectly happy letting you write to random places what? In C implementations on modern OSes, all pages mapped in your virtual address space will be read-only or read/write. I think some hardware does allow making pages write-only, but this is definitely not something you should expect. C as an abstract standard of course just says that writing outside of any object is Undefined Behaviour, so it's all implementation-specific behaviour here. A real-mode DOS C implementation might not fault at all here. – Peter Cordes – 2017-07-29T10:17:11.547

Also note that you're not trying to "read a second string from d." You're actually trying to read from one argument beyond d, so the pointer comes from whatever garbage was in that arg slot. d has nothing to do with the faulting address. I can't tell if you know this but explained it badly, or if you think that d could have had two back-to-back strings or something. – Peter Cordes – 2017-07-29T10:19:24.643

@PeterCordes I reworded it to better fit my intention. The reason I said C was fine letting you write to any location was the fact that the fgets was letting me read 12 ('\f') characters into a character array of length 8 ('\b') without segfaulting. I thought that might be the original solution until it didn't work on the TIO the asker linked. – PunPun1000 – 2017-07-29T17:37:03.557

A few bytes beyond the end of an array is not "a random place"! It's rare for that to segfault. Sometimes (in real programs that have multiple variables) it steps on something else, but sometimes it just hits padding. Or sometimes it corrupts a return address on the stack... – Peter Cordes – 2017-07-29T17:41:17.473

1@PeterCordes I've removed the unnecessary wording from my answer – PunPun1000 – 2017-07-29T17:58:19.253

3

C (gcc), Justin

With input %s, the program crashes.

#include<stdio.h>
int main(){char c[9];while(1){scanf("%8s",c);printf(c);}}

Try it online!

Conor O'Brien

Posted 2017-07-24T15:48:37.750

Reputation: 36 228

3

RProgN 2, ATaco

Cracked, with input #. I have no idea why, I think C evals, and # is a comment.

` .iS‘"{".C

Try it online!

Conor O'Brien

Posted 2017-07-24T15:48:37.750

Reputation: 36 228

O_o Unintended solution. # isn't a comment, but it pushed the "{" function literally when it eval'd, rather than executing it. +1. – ATaco – 2017-07-24T23:14:30.740

@ATaco Oh cool lol – Conor O'Brien – 2017-07-24T23:15:48.957

3

Javascript, Conor O'Brien

NaN

Yes, typeof NaN returns "number".

insert_name_here

Posted 2017-07-24T15:48:37.750

Reputation: 816

Darn. I forgot about that. – Conor O'Brien – 2017-07-24T23:48:22.777

2"Not a number" is a "number"? So it's basically in some kind of quantum state where it might or might not be a number depending on how you observe it. – Robert Fraser – 2017-07-25T06:38:34.527

3

C (gcc), dj0wns

The intended solution is probably:

%n

This treats char *a as a writable unsigned int, but since it is assigned to a constant string, this invokes undefined behaviour which on TIO gives me:

/srv/wrappers/c-gcc: line 5: 18569 Segmentation fault (core dumped) ./.bin.tio "$@" < .input.tio

Ken Y-N

Posted 2017-07-24T15:48:37.750

Reputation: 396

1Wow shows how much I suck at having a problem with one solution. Still not it! Nice job though. That was a really cool get, I didn't know about this at all – dj0wns – 2017-07-25T00:50:48.257

3

Node.js, Евгений Новиков

input:

{__proto__:null}

Try it online!

The input gets applied to an object. My input is an object with the same name as the native functions (__proto__) which will get applied to the object in the while condition and will override the native functions (such as toString and valueOf), causing an error when the program tries to cast the object to true/false for the while loop (because the necessary functions are missing and broken).

Grant Davis

Posted 2017-07-24T15:48:37.750

Reputation: 693

3

JavaScript (Node.js), tsh

The answer is '0'.

f=x=>{try{for(;!x||x!=0||x instanceof Object;);}catch(e){for(;;);}}

f('0')

Try it online!

Haumed Rahmani

Posted 2017-07-24T15:48:37.750

Reputation: 141

3

JavaScript (Node.js), Haumed Rahmani

JavaScript uses floats for everything, so...

f(100000000000000000)

Try it online!

NieDzejkob

Posted 2017-07-24T15:48:37.750

Reputation: 4 630

3

Java 8, Socratic Phoenix

-32760

Try it online.

The hardest part was recognising that taking >1s didn't mean it was stuck in a loop :P.

This is just due to the constant cache; the equality check is actually for identity.

Veedrac

Posted 2017-07-24T15:48:37.750

Reputation: 711

3

Python 3, Veedrac

>>> import sys
>>> class A(type): pass
... 
>>> for _ in range(sys.getrecursionlimit()+1):
...   class A(type, metaclass=A): pass
... 
>>> T(A)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in T
  File "<stdin>", line 2, in T
  File "<stdin>", line 2, in T
  [Previous line repeated 995 more times]
RecursionError: maximum recursion depth exceeded while calling a Python object

301_Moved_Permanently

Posted 2017-07-24T15:48:37.750

Reputation: 401

Brute force, I like it! – ecatmur – 2017-07-25T16:14:56.190

3

JavaScript, w0lf

This is the same hack as many others, really. There's probably a smarter solution, but this works.

{toString:1}

This just throws an error when calling toString.

JavaScript, w0lf v2

Same deal, no exception.

function(){ let x=0; return {toString: () => x++} }()

I'm pretty sure that's not the normal way to make anonymous objects with locals, but I figure someone will correct me in the comments.

Veedrac

Posted 2017-07-24T15:48:37.750

Reputation: 711

3

R, Jarko Dubbeldam

Just an invalid regex.

"["

Try it online.

Veedrac

Posted 2017-07-24T15:48:37.750

Reputation: 711

3

Python, Siphor

f('t=False')

Crashes due to an UnboundLocalError. I think this is hapening because my t=False overrides the higher-scoped t with the local t, but it's not set at the time of the loop, causing the crash.

TIO

Gavin S. Yancey

Posted 2017-07-24T15:48:37.750

Reputation: 617

This seems so easy, good job. – 301_Moved_Permanently – 2017-07-27T08:18:29.370

3

Commodore 64 Basic, Mark

If I understood this correctly (and it's entirely plausible I have not), you just need to overflow the floating point variable.

9999999999999999999999999999999999999999999999999999999999999999.9

Veedrac

Posted 2017-07-24T15:48:37.750

Reputation: 711

3You can use scientific notation for a shorter crack. A simple 1E50 will do just as well, and is easier to type. – Mark – 2017-07-25T22:16:59.197

3

Python 3, Veedrac

One value for which the program stops (with a ZeroDivisionError) is:

324835776096020208287573140963456

Try it online!

Edit: I'm not completely sure this is the smallest such value, but I will continue to check.

Edit2: OK, I've been looking for smaller solutions and haven't been able to find any. I cannot demonstrate that this is the smallest such value, but I'm pretty confident that it is.


Explanation

The algorithm does the following (considering the binary representations of the numbers):

  • p, n, and c are initialized to 0 (no bits set)
  • at each step, it consumes the 12 rightmost bits from x (the input)
  • out of these 12 bits, the 3 leftmost are discarded (&511) and only the remaining 9 bits are used. The value represented by these 9 bits is assigned to b.
  • out of the 9 bits, at most one must be set (b must be 0, or a power of 2), otherwise b&(b-1) will make the inner while loop forever.
  • the bit that is currently set in b will be set in p, n, and c
  • p is shifted 1 bit to the right (p>>=1)
  • n is shifted 1 bit to the left (n*=2)
  • in the next iteration, the bit set in b must be set in neither p, n, nor c (otherwise the (p|c|n)&b condition will make the inner while loop forever)

The objective is at the end to have all 9 bits in c set (it will be equal to 511 and therefore the last line will fail with the ZeroDivisionError), otherwise the last while will loop forever.

So, I was looking for a minimal way to make x out of 12-bit chunks, such that:

  • every chunk will have one of the rightmost 9 bits set
  • no chunk will "collide" diagonally with any of the former ones

The code I used to generate x with the smallest value I found is this:

chunks = [
        0b000000000001,
        0b000000000100,
        0b000000010000,
        0b000001000000,
        0b000100000000,
        0b000000000000,
        0b000000000010,
        0b000000001000,
        0b000000100000,
        0b000010000000,
]

x = 0
for c in (chunks):
    x += c
    x <<= 12
x >>= 12

print(x)

Cristian Lupascu

Posted 2017-07-24T15:48:37.750

Reputation: 8 369

3

C#, TheLethalCoder

new char[0]

string.Empty ("") is always interned. Therefore, an empty array or null will work.

dg3

Posted 2017-07-24T15:48:37.750

Reputation: 141

3

JavaScript, programmer5000

Symbol.split

Try it online!

ecatmur

Posted 2017-07-24T15:48:37.750

Reputation: 1 675

Also works with any other Symbol (e.g. Symbol()) - Symbols are spec'd to fail string conversions.

Very similar to Grant Davis' answer though.

– Birjolaxew – 2017-07-26T11:36:05.263

3

Husk, Leo

Pass 4 arguments! It only works with 0-3. You can't do it with less because the arguments aren't actually used.

Try it online.

Veedrac

Posted 2017-07-24T15:48:37.750

Reputation: 711

3

JavaScript, programmer5000

window[0]

Works on the Code Golf StackExchange page on Firefox (i.e. while(window[0] + "h"); throws a Error: Permission denied to access property Symbol.toPrimitive error in the console and exits)

jadkik94

Posted 2017-07-24T15:48:37.750

Reputation: 281

window apparently doesn't implement the [Symbol.toPrimitive] function (which is used when converting an object to a string) - nice find! – Birjolaxew – 2017-07-26T14:02:59.440

@Birjolaxew it's not window; see !!(window + "h") === true. Not sure what it is. Found it by looking at all the window attributes. I was sure one would fail because of a security exception or cross domain stuff. – jadkik94 – 2017-07-26T14:06:19.750

3

BASIC, Stilez

https://www.youtube.com/watch?v=9NcPvmk4vfo

This input halts the program. Weird choice, but it works.

NieDzejkob

Posted 2017-07-24T15:48:37.750

Reputation: 4 630

Ah nooooo! And its the 8 b8t version!! :) – Stilez – 2017-07-26T17:34:48.073

3

brainfuck, Jerry

B0000

Try it online!

Edit: This is the list of all 5-character input that makes the program halts, in range [a..z]: (Warning: large text file)

And this is all input in WordData[] of Mathematica 10:

{"aesop", "agape", "annon", "cloak", "daunt", "fagus", "filch", \
"gomel", "hijab", "jakes", "jerry", "rebut", "rover", "ruddy", \
"sewed", "trine", "villa"}

Perhaps jerry is the expected input.

Explanation:

First, we can see that there are 5 , signs in the program, therefore 5 characters are required. Call their character code {i0, i1, i2, i3, i4} respectively.

And, to "decrypt" the code:

>>,>,>,>,>,                     m0 = i0; m1 = i1; m2 = i2; m3 = i3; m4 = i4;
[-----------<-<+<--<--->>>>]    m3 -= m4 / 11; m2 += m4 / 11; m1 -= 2*m4 / 11; m0 -= 3*m4 / 11; m4 = 0;
<++<<+<++                       m3 += 2; m1 ++; m0 += 2;
[----->+<]                      m1 += m0 / 5; m0 = 0;
>
[----------------->+++++++<]    m2 += 7*m1 / 17; m1 = 0;
>
[----->>+<<]                    m4 += m2 / 5; m2 = 0;
>>
[-<->]                          m3 -= m4; m4 = 0;
<
[--->++++++<]                   m4 += 6*m3 / 3; m3 = 0;
>
[--->+<]                        m5 += m4 / 3; m4 = 0;
+>-                             m4 ++; m5 --;
[-----------------<+>]          m4 += m5 / 17; m5 = 0;
<
[-->-<]                         m5 -= m4 / 2; m4 = 0;
>+                              ++m5;
[+-]                            while (m5 != 0);

Where initially the tape has the form

... m-2 m-1 m0 m1 m2 m3 m4 m5 ...
     ^ (data pointer at initial position = m-2)

So, input

m5 = 0;
m0 = i0; m1 = i1; m2 = i2; m3 = i3; m4 = i4;
m3 -= m4/11; m2 += m4/11; m1 -= 2*m4/11; m0 -= 3*m4/11; m4 = 0;
m3 += 2; m1++; m0 += 2;
m1 += m0/5; m0 = 0;
m2 += 7*m1/17; m1 = 0;
m4 += m2/5; m2 = 0;
m3 -= m4; m4 = 0;
m4 += 6*m3/3; m3 = 0;
m5 += m4/3; m4 = 0;
m4++; m5--;
m4 += m5/17; m5 = 0;
m5 -= m4/2; m4 = 0;
++m5;

(note: over modulo 256, all divisions will halt, except the m5 -= m4/2 is because of at that point m4 is even)

into Mathematica gives

m5 = (117414 + 77 i0 + 385 i1 + 935 i2 - 4675 i3 + 419 i4)/238425

m5 == 0 can be transformed to (mod 256)

i4 := Mod[222 + 177 i0 + 117 i1 + 211 i2 + 225 i3, 256]

Loop i0, i1, i2, i3 through all combination of a..z gives 46413 results, of which 17 of them are English words.

user202729

Posted 2017-07-24T15:48:37.750

Reputation: 14 620

3

Swift 3, Alexander

extension Bool {
    prefix static func !(val: Bool) -> Bool {
        return false
    }
}

Add above the loop.

Veedrac

Posted 2017-07-24T15:48:37.750

Reputation: 711

Wow, defining the operation in an extension on Bool doesn't cause an ambiguity error, but defining it as a free function does. Odd. This wasn't what I had in mind, but well done, though! – Alexander - Reinstate Monica – 2017-07-31T03:43:08.793

2

JS (Node.js)

NaN

In JS, NaN !== NaN

programmer5000

Posted 2017-07-24T15:48:37.750

Reputation: 7 828

2

cQuents, Step Hen

1 2

Try it online!

Essentially, anything that matches /^.+ \d+$/ is valid input that will halt the program.

user41805

Posted 2017-07-24T15:48:37.750

Reputation: 16 320

A crack containing alphanumerics exists, if a cop wants to try it. – Stephen – 2017-07-24T17:04:24.607

@StepHen I am still trying, trying to figure out how the inputs work – user41805 – 2017-07-24T17:09:49.420

From documentation: Input is currently given as a space delimited list of numbers (although unless you do math on them they are not forced to be numbers, as in my test case on TIO) – Stephen – 2017-07-24T17:11:01.540

@StepHen Figured it out as soon as you posted that comment :D – user41805 – 2017-07-24T17:12:43.937

2

Java

The strings __.-._.-._.-.-.-.-.-._.-._._.-.-._. and __-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- work, with a minor bug: Integer.toHexString doesn't give a leading 0x, under Java 8. (I didn't try other versions.) Trimming it from the source makes it work fine.

user3033745

Posted 2017-07-24T15:48:37.750

Reputation: 121

@tuskiomi, it works in Jetbrains IntelliJ and in TIO, and neither prepend the 0x. The . characters are space-filler in the non-checked positions (only every other position is checked). – user3033745 – 2017-07-24T17:46:45.220

Well, you got me there. The characters could be technically anything... but this is the correct answer. – tuskiomi – 2017-07-24T17:50:14.250

Also, How'd ya figure this one out? ;) – tuskiomi – 2017-07-24T17:51:04.953

@tuskiomi I saw that the bitshifts at the bottom were constructing an int bit by bit with - being 1, and mentally transcribed the two hex ints to binary. Then I added in the padding to make it fit, and made the other string as simple as possible to enter the if. – user3033745 – 2017-07-24T17:54:59.670

Did you realize that the solution was bit-banging I2c? :) – tuskiomi – 2017-07-24T17:56:01.860

1@tuskiomi, I hadn't even heard of it until now, to be honest. It's obvious once I looked it up, though. Clever puzzle! – user3033745 – 2017-07-24T18:03:24.647

2

Java, tuskiomi

Fatally errors when the two arguments '_-_-_-_-_-' and '__________' are given.

Okx

Posted 2017-07-24T15:48:37.750

Reputation: 15 025

For me it keeps running – tuskiomi – 2017-07-24T17:43:10.043

Did you type it correctly? 10 underscores and then 5 underscores and 5 dashes alternating – Okx – 2017-07-24T17:43:55.977

I copied straight from your post; I just tried switching the parameter's order. no cigar. – tuskiomi – 2017-07-24T17:44:52.047

2

JavaScript (ES6), programmer5000

null

The condition was typeof x!=="object"||x; apparently null is an object but falsey in JavaScript.

Try it online!

Stephen

Posted 2017-07-24T15:48:37.750

Reputation: 12 293

2

JavaScript, programmer5000

null

That's basically it.

user41805

Posted 2017-07-24T15:48:37.750

Reputation: 16 320

@programmer5000 Sorry, I didn't see the mistake when trying to FGITW – user41805 – 2017-07-24T17:47:17.857

2

JavaScript, programmer5000

new Buffer(268435440)

Throws an error when it is coerced into a string.

Try it online!

Got it from this request for better error documentation.

Stephen

Posted 2017-07-24T15:48:37.750

Reputation: 12 293

Woah! Nice job! – programmer5000 – 2017-07-24T19:14:01.203

@programmer5000 thanks :P now go crack mine two newest ones, have fun :P – Stephen – 2017-07-24T19:15:00.270

2

JavaScript (Node.js)

g("13")(13/321)

It works, apparently you can replace 13 with 33, 53, etc

Juan Tonina - Reinstate Monica

Posted 2017-07-24T15:48:37.750

Reputation: 459

1That's not what I had in mind, but good job getting around what I had in mind, because you would never have guessed it :P – Stephen – 2017-07-24T19:28:19.927

2

Python 2, Foon

Crack or hack? I'm not sure which this is yet...

Windows:

exit()
<ctrl>C

Where <ctrl> is the actual key modifier. This will eval exit() in the first pass of the loop and catch the keyboard interrupt in the second. quit will work in place of exit too.

(Nix replace <ctrl>C with <ctrl>D ?)

Jonathan Allan

Posted 2017-07-24T15:48:37.750

Reputation: 67 804

2

Python 3.5, Siphor

"\r def t():pass"

Calling f("\r def t():pass") will redefine the "inner" t to a function that does nothing prior to it being created inside the "outer" t.

Jonathan Allan

Posted 2017-07-24T15:48:37.750

Reputation: 67 804

2

JavaScript by Grant Davis

({t:1,get x(){ return this.t--; }})

getter is powerful. you may also try Proxy.

tsh

Posted 2017-07-24T15:48:37.750

Reputation: 13 072

I used __proto__.defineGetter, but this is more elegant. This challenge has taught me a lot about JavaScript. – Grant Davis – 2017-07-25T03:27:03.033

2

Veedrac

Posted 2017-07-24T15:48:37.750

Reputation: 711

2

JavaScript (Node.js), tsh

code:

x=>{try{for(;!x||x!=0||x instanceof Object||typeof x!='object';);}catch(e){for(;;);}}

input:

{valueOf:g=>{Object=Number;return 0}}

Try it online!

!x: x resolves to true !true resolves to false

x!=0: valueOf is overridden and returns 0. 0!=0 is false Also sets Object to Number for next step

x instanceof Object: Object now points to Number and x is an Object not a Number so this resolves to false

typeof x!="object": x is an object so typeof x returns "object". "object"!="object" is false

Grant Davis

Posted 2017-07-24T15:48:37.750

Reputation: 693

Good job. instanceof is just something too weak... – tsh – 2017-07-25T05:06:24.073

@tsh Not hard to break things when one messes with prototypes and reassigns critical global variables. – Grant Davis – 2017-07-25T05:15:03.793

2

JavaScript (Node.js), 36 bytes, tsh

1.00000001

Any value near 1 under the rounding threshold will make it.

Try it online!

Vicente Gallur Valero

Posted 2017-07-24T15:48:37.750

Reputation: 201

Wow, love it. although that is not what I want... – tsh – 2017-07-25T08:50:06.143

2

Javascript (Node.js), programmer5000

Object.prototype

Object.prototype is the root prototype for all other objects, but it can't obviously have a prototype itself, because that would create a loop. Edit: I think this also works:

Object.create(null)

Neil

Posted 2017-07-24T15:48:37.750

Reputation: 95 035

2

Dennis

Posted 2017-07-24T15:48:37.750

Reputation: 196 637

2

Bash 4.2, Dennis

-9223372036854775808/-1

Why though, Dennis? y u do dis?

Veedrac

Posted 2017-07-24T15:48:37.750

Reputation: 711

1Well done. I had 2**63%-1, which results in the same operation. – Dennis – 2017-07-26T02:49:33.027

I assume this is a parsing or evaluation bug of some sort? What exactly causes it to fail? – Robert Fraser – 2017-07-26T07:51:08.407

1@RobertFraser It overflows! They're stored in small registers and the division generates a SIGFPE. – Veedrac – 2017-07-26T11:08:41.490

1

It's somewhat ironic that (on most platforms, including x86) unless you on purpose unmask FP exceptions, the only thing that will normally raise SIGFPE is an integer division exception. (by zero, or overflow). But POSIX requires integer division to raise SIGFPE if it raises any signal at all: https://stackoverflow.com/questions/37262572/on-which-platforms-does-integer-divide-by-zero-trigger-a-floating-point-exceptio

– Peter Cordes – 2017-07-27T10:39:38.537

2

JavaScript (Node.js) by Alex Varga

Updated with what I'd intended to post, thanks to Patrick Roberts' comment!

{valueOf:_=>process.exit(0)}

Try it online!

Dom Hastings

Posted 2017-07-24T15:48:37.750

Reputation: 16 415

1Technically that terminates the program before even entering the function, as the process.exit() is invoked inside the call rather than the body. However, changing to {valueOf(){process.exit()}} would be sufficient. – Patrick Roberts – 2017-07-28T07:05:35.610

@PatrickRoberts yeah, that's what I'd intended to post... Not sure how I posted the wrong one. I validated it entered the loop on my system, but clearly missed that.. otherwise, I guess I could have just added process.exit(0) on its own, which kinda misses the point of the challenge really. Thanks for the nod! – Dom Hastings – 2017-07-28T07:47:02.567

Also, the username typically links to their cop answer, not their account page, while you're editing. – Patrick Roberts – 2017-07-28T07:49:28.583

2

Pyth, isaacg

Seems to halt every time. Input:

.q

Try it here!

Adnan

Posted 2017-07-24T15:48:37.750

Reputation: 41 965

1Two seconds faster, lol. – Veedrac – 2017-07-26T11:38:19.033

2

Pyth, isaacg

.q

This quits the program.

Try it online.

Veedrac

Posted 2017-07-24T15:48:37.750

Reputation: 711

2

C, Steadybox

1597463007 1065353216

Try it online.

This one was clever.

Veedrac

Posted 2017-07-24T15:48:37.750

Reputation: 711

2

Pyth, isaacg

exec(input())
__import__("os")._exit(1)

I call this "privilege escalation" :P.

Veedrac

Posted 2017-07-24T15:48:37.750

Reputation: 711

2

C++, ecatmur

struct C { int m; };
int C::* t = &C::m;

Try it online!

For some reasons, default initialization of pointer-to-member make that -1, which become true when cast to bool.

user202729

Posted 2017-07-24T15:48:37.750

Reputation: 14 620

2

R, Jarko Dubbeldam

"unlist"

Though it's just one more function that could be added to the exceptions - I doubt it's the intended solution.


Two more cracks: 'is.vector' and 'return'. These both work on the modified (list(0)) version.

Gregor Thomas

Posted 2017-07-24T15:48:37.750

Reputation: 271

2you're right, not intended, but good solution! Instead of turning a fix into a new post, do you mind if I change list(1) to list(0)? :D – JAD – 2017-07-27T20:35:18.247

Sounds good to me :) – Gregor Thomas – 2017-07-27T20:54:22.373

1@JarkoDubbeldam See edits for two more cracks that work on the list(0) version. 'return' seems like it might even be the intended solution. – Gregor Thomas – 2017-07-27T21:00:26.467

Getting closer, but not the intended solution. – JAD – 2017-07-28T04:42:50.257

1A few more cracks for the new version: "NROW", "NCOL", and "lengths" – Gregor Thomas – 2017-07-28T06:16:00.827

lengths is a thing... TIL – JAD – 2017-07-28T06:21:55.753

It's new - introduced in R 3.2.0. Really nice when you need it. – Gregor Thomas – 2017-07-28T06:30:53.133

2

JavaScript, iovoid

this.constructor.constructor("return process")().exit()

Try it online!

Alex Reinking

Posted 2017-07-24T15:48:37.750

Reputation: 255

2

Python, Alex Hall

"%307d"%1

This creates a truthy string consisting of 306 spaces followed by 1.

hvd

Posted 2017-07-24T15:48:37.750

Reputation: 3 664

2

JavaScript (Node.js >= 6.0), Patrick Roberts

{__proto__:Function,toString:_=>process.kill(0)}

This probably isn't the intended answer, but it does work. It kills the process without giving either the exit handler or the exception handler a chance to run. Sending to PID 0 is shorter than to process.pid and sends the signal to all processes in the current process group.

hvd

Posted 2017-07-24T15:48:37.750

Reputation: 3 664

Ah, unfortunate... Interesting object literal though, can't say I've ever seen one with a __proto__ attribute in it. And no, this wasn't quite it, but it was indeed creative, and probably more efficient than my answer. – Patrick Roberts – 2017-07-31T03:21:12.467

2

Python 2, by veedrac

import os, functools
class A:__int__ = os.abort
k(functools.partial(int, A()))

pppery

Posted 2017-07-24T15:48:37.750

Reputation: 3 987

Nice effort; I see your solution to mine is very similar to my solution to yours. This wasn't the intended solution, but I only just figured out partial can be used like this so fair play. I'll probably add a revision that bans functools.partial, but I'll leave that for another day. – Veedrac – 2017-07-31T03:01:38.650

2

Leaky Nun

Posted 2017-07-24T15:48:37.750

Reputation: 45 011

2

Python 3, E.D. (Fixed)

The input 0526315789473684210344827586206896551724137931020408163265306122448979591836734693877551 halts the fixed program. Since each of the three chunks are separate from each other, you can compute them individually, then combine them together. A coworker of mine figured out the logic and wrote the script to generate this answer.

Also, the fix didn't entirely work as an input of "0"*88+"1" will halt the program as well, since the check for a nonzero n checks the whole string, while only n[:88] is used in the calculations. So, any input of the form "0"*88+A where A is a string where all elements are digits, and at least one is nonzero, will cause the program to halt.

Try it online!

Arnold Palmer

Posted 2017-07-24T15:48:37.750

Reputation: 443

1

JavaScript (ES6), programmer5000

"Infinity"

The condition first tests if the input has a .slice method (aka if it's a string or an array) and gets the absolute value of the numeric representation of the string/array. This is then added to 0 and checked against Infinity.

Try it online!

Stephen

Posted 2017-07-24T15:48:37.750

Reputation: 12 293

:( I thought mine would last longer! Nice Job! – programmer5000 – 2017-07-24T18:07:13.550

@programmer5000 thanks :) – Stephen – 2017-07-24T18:08:05.807

[Infinity] also works. – Cristian Lupascu – 2017-07-25T13:41:48.930

@w0lf also ["Infinity"] – Stephen – 2017-07-25T13:45:18.037

1

Add++, caird coinheringaahing

The empty input. The answer is pretty pointless, since it never runs in an infinite loop.

Try it online!

Mr. Xcoder

Posted 2017-07-24T15:48:37.750

Reputation: 39 774

1

Braingolf, Mayube

Answer

163

Code explanation:

1+[#£-0!e>:$_1>|]

1+                  # Add 1 to the input
  [             ]   # While bottom of the stack > 0..
   #£               #   Push 163
     -              #   Subtract from the input
      0             #   Push 0
       !            #   Peek top of the stack 
        e           #   If greater than zero, do..
         >          #     Rotate the stack one to the right
          :         #   Else..
           $_       #     Discard top of the stack
             1      #     Push
              >     #     Rotate the stack one to the right
               |    #   End ifelse

Which results in outputting 0.

Try it online!

Adnan

Posted 2017-07-24T15:48:37.750

Reputation: 41 965

Woop! You got it! Fyi 163 is the Unicode codepoint of £ – Skidsdev – 2017-07-24T18:18:45.403

@Mayube Yeah, just running alone gave it a bit away :p. – Adnan – 2017-07-24T18:22:13.037

Darn! I actually tested 163 as an argument and it didn't work at all! – Erik the Outgolfer – 2017-07-24T19:58:46.043

@EriktheOutgolfer then you did something wrong, it's taken as an argument – Skidsdev – 2017-07-24T20:09:35.090

@Mayube I just passed in 163...maybe I saw something wrong. – Erik the Outgolfer – 2017-07-24T20:09:59.917

Also @Adnan It really warms my heart to see somebody else understand braingolf enough to be able to post their own char-by-char explanation <3 – Skidsdev – 2017-07-24T20:10:07.543

Although quick correction, [] loops check the bottom of the stack, not the top – Skidsdev – 2017-07-24T20:10:52.807

@Mayube Thanks, it has been corrected. – Adnan – 2017-07-24T23:21:41.360

1

JS, Step Hen

991

Lots of obfuscation!

Try it online!

programmer5000

Posted 2017-07-24T15:48:37.750

Reputation: 7 828

1How did you unobfuscate this? – user41805 – 2017-07-24T19:25:21.523

@Cowsquack Removed everything except the obfuscated code, than removed the (). – programmer5000 – 2017-07-24T19:31:12.153

>

  • Step Hen :P and @Cowsquack JSF*** decoder
  • – Stephen – 2017-07-24T19:35:30.957

    1

    Node.JS, programmer5000

    x = {}
    x.constructor = false
    f(x)
    

    We define an object where x.constructor is false so it terminates immediately

    TIO

    Gavin S. Yancey

    Posted 2017-07-24T15:48:37.750

    Reputation: 617

    1

    Python 3, Erik Brody Dreyer

    While error raising cracks are 10 a penny, a simple non-erroring one is just 88 zeros in a row:

    def fun(n):
    while not (int(n[17]+n[:17])==2*int(n[:18]) and int(n[45]+n[18:45])==3*int(n[18:46]) and int(n[87]+n[46:87])==5*int(n[46:88])):
        print("Ha")
    fun("0"*88)
    print("halted and did not error")
    

    Try it online!

    Jonathan Allan

    Posted 2017-07-24T15:48:37.750

    Reputation: 67 804

    1

    JavaScript (Node.js), programmer5000

    Object.defineProperty(a={},"__proto__",{value:false,writable:false})
    

    Try it online!

    Simple enough. A truthy object who's __proto__ is defined to be false permanently.

    Conor O'Brien

    Posted 2017-07-24T15:48:37.750

    Reputation: 36 228

    1

    JavaScript (Babel Node), programmer5000

    new Set() was posted as a crack but didn't work for me (Try it online!), so I made one that doesn't throw, but does create a TypeError.

    let f=x=>{while(x+"h");}
    
    class Halt {
        toString() {
    	return {}
        }
    }
    f(new Halt())
    

    Try it online!

    P.S. The solution I really wanted was to negate the charCode somehow and be errorless but I couldn't get that to not resolve to concatenation. :)

    EDIT: An more modern alternative:

    f( {
        [Symbol.toPrimitive] (hint) {
            return {}
        }
    } )
    

    Haumed Rahmani

    Posted 2017-07-24T15:48:37.750

    Reputation: 141

    Good, but still not desired! – programmer5000 – 2017-07-25T01:19:47.153

    So there's an error-free solution? – Haumed Rahmani – 2017-07-25T01:21:20.523

    1A solution that doesn't use throw. – programmer5000 – 2017-07-25T01:22:08.033

    1

    Python 2, Quelklef

    def x():
        import ctypes
        ctypes.cast(1, ctypes.POINTER(ctypes.c_int))[0]
    
    f(x)
    

    I'm sure this isn't the intended solution, but a segfault counts, right?

    Veedrac

    Posted 2017-07-24T15:48:37.750

    Reputation: 711

    Not intended, but does work... Wish I could disable imports. – Quelklef – 2017-07-25T01:53:39.627

    1

    Python 2, Quelklef

    def f(x):
    	try:x()
    	except:1
    	while True:1
    def x():global True;True=False
    f(x)
    

    Try it online!

    Redefines True to False.

    xnor

    Posted 2017-07-24T15:48:37.750

    Reputation: 115 687

    Yay! This is the solution I was looking for! I did it differently, as f( lambda: globals().update({"True": False}) ) – Quelklef – 2017-07-25T02:33:50.270

    1

    J, miles

    Input: '' (the empty vector). Errors with an index error.

    $:@#~^:(0([=[e.{#])#~) ''
    

    This approach (erroring out) will work for infinity, floats, and non-positive numbers.

    The intended approach is probably an imaginary number, such as 2j2, which returns a result.

       $:@#~^:(0([=[e.{#])#~) 2j2
    2j2
    

    Let's decompose the program:

    $:@#~^:(0([=[e.{#])#~) 
    $:@                       call this function (recurse)
       #~                     with the input repeated itself times
         ^:(             )    if:
            0(    f   )#~         f(0, #~ y)
              [=[e.{#]
    
    
    dyad:
    [ = [ e. { # ]  x = 0, y = #~ y
               #    repeat
                 ]     y
             {         y[0] times
        [ e.        check if 0 is in this list
    [ =             check if that is false
    

    So, we want an input y such that (0{y) # (#~ y) contains a zero. When using an imaginary number as y = a + bi, we get:

    #~ y
    y # y
    (a + j. b) # y
    (a # y) , (b # 0)
    

    Which gives us b zeroes in the input. This will make the aforementioned condition false, and this only run once.

    Conor O'Brien

    Posted 2017-07-24T15:48:37.750

    Reputation: 36 228

    Does ending with an error count as cracked? There is actually an input that lets it exit without error. Good find, I didn't think of testing empty input. – miles – 2017-07-25T02:48:15.320

    @miles Yeah, so long as the program is finite. I'm still looking for a non-empty solution, however. – Conor O'Brien – 2017-07-25T02:50:02.817

    Yes, that's what I had in mind, I'll have to test more input types next time. – miles – 2017-07-25T03:11:28.130

    @miles Cool! That was fun, I learned something new about # today. – Conor O'Brien – 2017-07-25T03:12:35.800

    Yeah, it's one of the few features I haven't found a good use for yet. – miles – 2017-07-25T03:13:35.093

    1

    R, Rift

    expression(T <- 0)
    

    Sets T to a false value. I don't know R, seems to work.

    Try it online.

    Veedrac

    Posted 2017-07-24T15:48:37.750

    Reputation: 711

    1

    JavaScript (browser), tsh

    document.all
    

    I started trying falsy values. document.all did the job.

    Hawkings

    Posted 2017-07-24T15:48:37.750

    Reputation: 191

    1

    JS, 11bytes / 18bytes

    code:

     f=a=>{while(!Array.isArray(a)||!a.length);a.map(_=>{for(;;);})}
    

    cracked (throws no error):

    f(Array(5))
    

    cracked (throws error):

     a=[1];a.map=1;f(a)
    

    Jonas Wilms

    Posted 2017-07-24T15:48:37.750

    Reputation: 131

    1

    JavaScript, Step Hen

    One input that stops the program is the object literal {valueOf: () => false}:

    var f=x=>{while(!(x&&x==false));};
    f({valueOf: () => false});
    console.log('Done!');

    Cristian Lupascu

    Posted 2017-07-24T15:48:37.750

    Reputation: 8 369

    1

    Dennis

    Posted 2017-07-24T15:48:37.750

    Reputation: 196 637

    1

    Python 3 (CPython), Veedrac

    import gc
    gc.set_debug(gc.DEBUG_SAVEALL)
    gc.collect()
    l(gc.garbage[0])
    

    Try it online!

    ecatmur

    Posted 2017-07-24T15:48:37.750

    Reputation: 1 675

    One man's garbage... (nicely done) – Veedrac – 2017-07-25T15:05:42.690

    1

    JS, Step Hen

    "void 0"
    

    Simple: the 5th char is , the string doesn't have any trailing or leading whitespace, and evaled results in undefined.

    programmer5000

    Posted 2017-07-24T15:48:37.750

    Reputation: 7 828

    1How did you know about that :( good job – Stephen – 2017-07-25T15:22:59.363

    1@StepHen alot of poorly written websites link to javascript:void 0 to do nothing, and many compressors replace undefined with void 0. – programmer5000 – 2017-07-25T15:24:00.333

    1

    @programmer5000 http://hyperboleandahalf.blogspot.com/2010/04/alot-is-better-than-you-at-everything.html

    – NieDzejkob – 2017-07-25T18:32:02.503

    1

    R Jarko Dubbeldam

    f=function(x)while(1)if(length(x))grep(x,'')

    Fails with a function argument, e.g.,

    f(mean)
    # Error in as.character(pattern) : 
      cannot coerce type 'closure' to vector of type 'character'
    

    Try it online!

    Gregor Thomas

    Posted 2017-07-24T15:48:37.750

    Reputation: 271

    1

    anyfix, Mayube

    -5
    

    Easy enough once you learn the neat language. Basically once you make 0 from the addition, the rest is fluff.

    Try it online.

    Veedrac

    Posted 2017-07-24T15:48:37.750

    Reputation: 711

    1

    JavaScript by w0lf

    Object(NaN)
    

    Another crack, more elegant way.

    tsh

    Posted 2017-07-24T15:48:37.750

    Reputation: 13 072

    1

    Python 3, Magenta

    def f(x):
     y=str(x)
     while not(x and(y[-1]+y[:-1])==str(2*x)):a=1
    

    The trick is to find a number x which when multiplied by two is equal to itself when all the digits are shifted to the right, with wrapping.

    Isaacg found the first number for which this works (105263157894736842), and using the same pattern, I found a bunch more inputs: 210526315789473684, 421052631578947368, 315789473684210526 all work.

    Because I didn't make the original crack, and @Isaacg hasnt posted this yet, I made this as CW.

    Note that these numbers are formed from the decimal expansion of 1/19.

    JAD

    Posted 2017-07-24T15:48:37.750

    Reputation: 2 898

    1

    R, Jarko Dubbeldam

    expression(quit())
    

    Try it online.

    Veedrac

    Posted 2017-07-24T15:48:37.750

    Reputation: 711

    Nice, indeed the intended solution. – JAD – 2017-07-26T11:44:14.213

    1

    CPython 3.6, by wizzwizz4

    lambda *a,main=__import__("__main__"):(exec("""main.bool=lambda:True"""),1/0)
    

    pppery

    Posted 2017-07-24T15:48:37.750

    Reputation: 3 987

    1

    Dennis

    Posted 2017-07-24T15:48:37.750

    Reputation: 196 637

    1

    C++, ecatmur

    Truly the most beautiful code I have ever written.

    #include <iostream>
    
    auto killmenow = 0;
    
    struct Tee {
        Tee() { if (killmenow++ > 10) { exit(0); } }
    };
    
    auto t = Tee{};
    
    int main() {
        f<Tee &, t>(t);
    }
    

    This question really confuses me, ergo the above disaster.

    Try it online.

    Veedrac

    Posted 2017-07-24T15:48:37.750

    Reputation: 711

    Totally not the intended solution, but absolutely a valid crack. – ecatmur – 2017-07-26T19:52:38.250

    1

    Python, Sudo Bash

    import signal
    
    class x:
        @property
        def x(self):
            signal.alarm(1)
        def __str__(self):
            return 'x.x'
    

    tbodt

    Posted 2017-07-24T15:48:37.750

    Reputation: 2 176

    1

    Python 3 by Veedrac

    A single 0xff byte for UTF-8, or anything else that cannot be decoded by the selected encoding.

    Try it online!

    Dennis

    Posted 2017-07-24T15:48:37.750

    Reputation: 196 637

    1

    dhaffey

    Posted 2017-07-24T15:48:37.750

    Reputation: 111

    1

    Swift, Alexander

    func ==(lhs: Int, rhs: Int) -> Bool {
        return false
    }
    

    Redefine the == operator to always return false. This means that now, 0 works because 0 == 0 is now false, and 0 != 0 is still false

    Alternatively, redefine the != operator to always return false so that every integer other than 0 will halt.

    Daniel

    Posted 2017-07-24T15:48:37.750

    Reputation: 6 425

    Solved, but I have another! It's shorter, too! https://codegolf.stackexchange.com/a/136343/11490

    – Alexander - Reinstate Monica – 2017-07-28T08:02:48.027

    I'm just blown away that this is something you can do. First I've seen a language allow the redefinition of critical operators. – Sirens – 2017-08-02T05:40:08.743

    1

    Python 3: totallyhuman's post, 143 bytes

    def f(o):
     while bool(o)==bool(o):0
    
    # My code starts here
    
    class A:
    	def __init__(s):s.a=False
    	def __bool__(s):s.a=not s.a;return s.a
    
    f(A())
    

    Try it online!

    HyperNeutrino

    Posted 2017-07-24T15:48:37.750

    Reputation: 26 575

    1

    Python 2, Alex Hall

    __builtin__,True,
    

    Try it online!

    We override True to the empty string, which is falsy.

    Sisyphus

    Posted 2017-07-24T15:48:37.750

    Reputation: 1 521

    Well done. That was the intended solution. – Alex Hall – 2017-07-29T12:18:31.417

    1

    Python 3, Alex Hall

    eval(input())
    __import__("os")._exit(0)
    

    Try it online!

    Clearly not the intended answer. Bypasses the length limit by evaluating the input.

    Sisyphus

    Posted 2017-07-24T15:48:37.750

    Reputation: 1 521

    1

    Batch, SteveFest

    Just undo the quote.

    "&&exit 
    

    (with a trailing )

    Another unintended solution:

    "|exit
    

    user202729

    Posted 2017-07-24T15:48:37.750

    Reputation: 14 620

    Well done! Although this is not me intended solution – stevefestl – 2017-07-29T12:45:39.373

    I will add the link to here shortly – stevefestl – 2017-07-29T12:45:57.850

    1

    C (gcc), dj0wns

    %s12345678
    

    Try it Online!

    Since c is only defined as an 8 ('\b') character array and the fgets is passed a second argument of 12 ('\f') longer strings begin to corrupt d which is located after c on the stack. Adding enough characters will cause the snprintf to segfault when it tries to reference the pointer d which has been corrupted

    PunPun1000

    Posted 2017-07-24T15:48:37.750

    Reputation: 973

    Yay! You found it! – dj0wns – 2017-07-30T18:48:09.643

    I wanted to find a way to make a buffer overflow non-obvious so my misdirection added alternate solutions sadly. – dj0wns – 2017-07-30T18:59:59.207

    1

    Python, by veedrac

    import sys;sys.settrace(-1)
    

    The -1 can be replaced with any other non-callable object

    pppery

    Posted 2017-07-24T15:48:37.750

    Reputation: 3 987

    Well, that was fast. – Veedrac – 2017-07-30T23:10:00.400

    Was this the intended solution? – pppery – 2017-07-30T23:13:57.197

    Yep, this was it. – Veedrac – 2017-07-30T23:15:40.480

    I've done far worse things with sys.setprofile and sys.settrace

    – pppery – 2017-07-30T23:16:45.160

    1

    05AB1E, MilkyWay90

    1
    

    TIO

    Pretty easy one, all I had to do was look up the command list for the language.

    Draco18s no longer trusts SE

    Posted 2017-07-24T15:48:37.750

    Reputation: 3 053

    Yeah, my one was easy to crack. – MilkyWay90 – 2018-12-19T03:02:02.773

    @MilkyWay90 Nothing wrong with that, either. – Draco18s no longer trusts SE – 2018-12-19T03:23:55.167

    Okay, thank you! I have another answer that you could crack (A BrainF one) – MilkyWay90 – 2018-12-19T03:25:55.453

    @MilkyWay90 I don't know anything about-- – Draco18s no longer trusts SE – 2018-12-19T03:28:11.383

    Oh, okay. I didn't know anything about it until today so... – MilkyWay90 – 2018-12-19T03:28:57.710

    My comment terminated early because I'd solved it mid-sentence. – Draco18s no longer trusts SE – 2018-12-19T03:31:00.877

    Let us continue this discussion in chat.

    – MilkyWay90 – 2018-12-20T00:11:38.030

    0

    JavaScript (Node.js), Step Hen

    Array(4) works because it is creating an empty array of size 4 and the string representation of that is ,,,.

    Try it online!

    totallyhuman

    Posted 2017-07-24T15:48:37.750

    Reputation: 15 378

    0

    Java 8, Socratic Phoenix

    These anonymous class answers are getting a bit overdone, but it works and I have no shame.

    import java.util.ArrayList;
    
    // ...
    
    new ArrayList<Object>() {
        public boolean isEmpty() {
            boolean ret = !super.isEmpty();
            add(new Object());
            return ret;
        }
    }
    

    You can avoid the import if you're patient enough to build out all the List methods. I'm not.

    Try it online.

    Veedrac

    Posted 2017-07-24T15:48:37.750

    Reputation: 711

    0

    JavaScript (Node.js) by Alex Varga

    ({toString(){return this.t--;},t:1})
    

    Try it online!

    tsh

    Posted 2017-07-24T15:48:37.750

    Reputation: 13 072

    yep. golfed a little: {valueOf:()=>this.q?0:this.q=1} – Alex Varga – 2017-07-26T15:09:00.813

    0

    R, Gregor

    expression(set.seed(5))
    

    Similar principle to my other R answer. Seems to work.

    Try it online.

    Veedrac

    Posted 2017-07-24T15:48:37.750

    Reputation: 711

    0

    R, Jarko Dubbeldam

    just break out of the while loop

    expression(break)
    

    Rift

    Posted 2017-07-24T15:48:37.750

    Reputation: 91

    0

    R, Jarko Dubbeldam

    it's my first time that I participated at something like this... hope i got it right.

    .Internal(.invokeRestart(list(NULL, NULL), NULL))
    

    Try it online!

    Mischa

    Posted 2017-07-24T15:48:37.750

    Reputation: 117

    I guess that's the intended solution. f(quit()) would also work – Rift – 2017-07-26T15:30:39.513

    1This is not really a crack. Both this solution and @Rift quit before (or regardless of) evaluating the function. – JAD – 2017-07-27T07:41:29.917

    Both solutions are evaluated in the function body. – Rift – 2017-07-27T08:05:30.767

    0

    CPython 3.6, by wizzwizz4

    1/0
    

    Almost certainly not the intended solution, but it works

    pppery

    Posted 2017-07-24T15:48:37.750

    Reputation: 3 987

    0

    SmallTalk, Yimin Rong

    1086
    

    I should have trusted him.

    Veedrac

    Posted 2017-07-24T15:48:37.750

    Reputation: 711

    0

    JavaScript, Birjolaxew

    Object.freeze({[Symbol.toPrimitive]() { raise; }})
    

    Veedrac

    Posted 2017-07-24T15:48:37.750

    Reputation: 711

    raise isn't a JS keyword, you might be looking for throw – SuperStormer – 2017-07-27T01:26:14.190

    1@SuperStormer Doesn't matter anyway :P. – Veedrac – 2017-07-27T01:26:50.457

    0

    JavaScript (ES7), iovoid

    46474849
    

    WolframAlpha made the calcs trivial.

    Veedrac

    Posted 2017-07-24T15:48:37.750

    Reputation: 711

    0

    JavaScript (ES7), Step Hen

    I've found 5 solutions that work, so far:

    []
    
    new Array()
    
    Array.prototype
    
    String.prototype
    
    Number.prototype
    

    Strangely, Object.prototype doesn't work.

    Shaggy

    Posted 2017-07-24T15:48:37.750

    Reputation: 24 623

    Oh, I completely forgot that that is basically the same as my intended solution. I'd love for you to figure out why though :P it's a really weird perk of floats I just discovered – Stephen – 2017-07-27T16:45:16.947

    I'll come back to it in the morning, @StepHen; I'm about to pack up for the day. – Shaggy – 2017-07-27T16:46:59.843

    I'll tell you why. Check Boolean(input) and Number(input) for each of those as input. The "weird perk of floats" is that the exponentiation operator ** will convert any left operand, even something that coerces to NaN, into 1 if the right operand coerces to 0. Since Number(Object.prototype) is NaN and not 0 like the rest of the working inputs, it will not work. – Patrick Roberts – 2017-07-29T04:57:13.647

    0

    JavaScript, Birjolaxew

    new Proxy({},{get(){throw''}})
    

    Patrick Roberts

    Posted 2017-07-24T15:48:37.750

    Reputation: 2 475

    0

    Befunge 93, Dopapp

    <
    

    The code calculates (ord(input) - 3*4*5) / 0 = (ord(input) - 60) / 0, which gives Infinity or -Infinity for any ascii value ≠60 and NaN for ascii value 60 (<) on the linked interpreter. The part #v_@ only terminates if the top value of the stack is falsy, which is only the case for NaN.

    ovs

    Posted 2017-07-24T15:48:37.750

    Reputation: 21 408

    0

    Python3, by AlexHall

    Probably not what OP had in mind:

    help.__doc__
    

    Here's a test on my system:

    Python 3.6.0 |Anaconda 4.3.1 (64-bit)| (default, Dec 23 2016, 12:22:00) 
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
    >>> s = "help.__doc__"
    >>> len(s)
    12
    >>> eval(s)
    "Define the builtin 'help'.\n\n    This is a wrapper around pydoc.help that provides a helpful message\n    when 'help' is typed at the Python interactive prompt.\n\n    Calling help() at the Python prompt starts an interactive help session.\n    Calling help(thing) prints help for the python object 'thing'.\n    "
    >>> len(eval(s))
    307
    

    It doesn't work with Python2 on my system.

    Eric Duminil

    Posted 2017-07-24T15:48:37.750

    Reputation: 701

    0

    BrainF, MilkyWay90

    0

    I brute forced this one. My first guess was correct. And two subsequent inputs to make sure I was right.

    Oops?

    Draco18s no longer trusts SE

    Posted 2017-07-24T15:48:37.750

    Reputation: 3 053

    Never thought about bruteforcing, actually. – MilkyWay90 – 2018-12-20T00:13:05.703

    0

    JavaScript (Node.js)

    I've done some research, and find out that JavaScript that only uses ()[]+! is called JSFuck. With the help of JScrewIt and JS Minify, I've found the solution:

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

    Try it online!

    Explanation

    [][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]][([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+([][[]]+[])[+!![]]+(![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+[]]+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+(!![]+[])[+!![]]]((!![]+[])[+!![]]+(!![]+[])[!![]+!![]+!![]]+(!![]+[])[+[]]+([][[]]+[])[+[]]+(!![]+[])[+!![]]+([][[]]+[])[+!![]]+(![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+[+[]]]+(!![]+[])[!![]+!![]+!![]]+([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+[!![]+!![]+!![]]]+(![]+[])[+!![]]+(![]+[])[!![]+!![]])()( // eval function, copied from https://jscrew.it/ with only Node.js support
                                                                                                                            // '"'
        ([]+[])[                                                                                                                // ''['fontcolor']() == '<font color="undefined"></font>'
            (![]+[])[+[]]+                                                                                                          // f
            (!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+              // o
            ([][[]]+[])[+!![]]+                                                                                                     // n
            (!![]+[])[+[]]+                                                                                                         // t
            ([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+             // c
            (!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+              // o
            (![]+[])[!![]+!![]]+                                                                                                    // l
            (!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+              // o
            (!![]+[])[+!![]]                                                                                                        // r
        ]()[                                                                                                                    // ''['fontcolor']()['12'] == 'u'
            +!![]+                                                                                                                  // 1
            [!![]+!![]]                                                                                                             // 2
        ]+
        (                                                                                                                   // '\\'
            +[![]]+                                                                                                             // NaN
            [][                                                                                                                 // []['fill']
                (![]+[])[+[]]+                                                                                                      // f
                ([![]]+[][[]])[+!![]+[+[]]]+                                                                                        // i
                (![]+[])[!![]+!![]]+                                                                                                // l
                (![]+[])[!![]+!![]]                                                                                                 // l
            ][                                                                                                                  // []['fill']['constructor']
                ([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+         // c
                (!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+          // o
                ([][[]]+[])[+!![]]+                                                                                                 // n
                (![]+[])[!![]+!![]+!![]]+                                                                                           // s
                (!![]+[])[+[]]+                                                                                                     // t
                (!![]+[])[+!![]]+                                                                                                   // r
                ([][[]]+[])[+[]]+                                                                                                   // u
                ([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+         // c
                (!![]+[])[+[]]+                                                                                                     // t
                (!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+          // o
                (!![]+[])[+!![]]                                                                                                    // r
            ](                                                                                                                  // []['fill']['constructor']('return/false/')() == /false/
                (!![]+[])[+!![]]+                                                                                                   // r
                (!![]+[])[!![]+!![]+!![]]+                                                                                          // e
                (!![]+[])[+[]]+                                                                                                     // t
                ([][[]]+[])[+[]]+                                                                                                   // u
                (!![]+[])[+!![]]+                                                                                                   // r
                ([][[]]+[])[+!![]]+                                                                                                 // n
                                                                                                                                    // /
                (!![]+[])[                                                                                                              // 'true'['sub']() == '<sub>true</sub>'
                    (![]+[])[!![]+!![]+!![]]+                                                                                               // s
                    ([][[]]+[])[+[]]+                                                                                                       // u
                    (                                                                                                                       // b
                        [][                                                                                                                     // []['entries']
                            (!![]+[])[!![]+!![]+!![]]+                                                                                              // e
                            ([][[]]+[])[+!![]]+                                                                                                     // n
                            (!![]+[])[+[]]+                                                                                                         // t
                            (!![]+[])[+!![]]+                                                                                                       // r
                            ([![]]+[][[]])[+!![]+[+[]]]+                                                                                            // i
                            (!![]+[])[!![]+!![]+!![]]+                                                                                              // e
                            (![]+[])[!![]+!![]+!![]]                                                                                                // s
                        ]()+                                                                                                                    // []['entries']() == Object [Array Iterator] {}
                        []                                                                                                                      // []['entries']() + [] == '[object Array Iterator]'
                    )[!![]+!![]]                                                                                                                // '[object Array Iterator]'[2] == 'b'
                ]()[+!![]+[+[]]]+                                                                                                       // '<sub>true</sub>'[10] == '/'
                ![]+                                                                                                                // 'false'
                (!![]+[])[                                                                                                          // / (see above)
                    (![]+[])[!![]+!![]+!![]]+
                    ([][[]]+[])[+[]]+
                    (
                        [][
                            (!![]+[])[!![]+!![]+!![]]+
                            ([][[]]+[])[+!![]]+
                            (!![]+[])[+[]]+
                            (!![]+[])[+!![]]+
                            ([![]]+[][[]])[+!![]+[+[]]]+
                            (!![]+[])[!![]+!![]+!![]]+
                            (![]+[])[!![]+!![]+!![]]
                        ]()
                        +[]
                    )[!![]+!![]]
                ]()[+!![]+[+[]]]
            )()[                                                                                                                // /false/['constructor']
                ([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+         // c
                (!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+          // o
                ([][[]]+[])[+!![]]+                                                                                                 // n
                (![]+[])[!![]+!![]+!![]]+                                                                                           // s
                (!![]+[])[+[]]+                                                                                                     // t
                (!![]+[])[+!![]]+                                                                                                   // r
                ([][[]]+[])[+[]]+                                                                                                   // u
                ([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+         // c
                (!![]+[])[+[]]+                                                                                                     // t
                (!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+          // o
                (!![]+[])[+!![]]                                                                                                    // r
            ](                                                                                                                  // /false/['constructor']('<sub></sub>') == /<sub><\/sub>/
                ([]+[])[
                    (![]+[])[!![]+!![]+!![]]+                                                                                       // s
                    ([][[]]+[])[+[]]+                                                                                               // u
                    (                                                                                                               // b
                        [][
                            (!![]+[])[!![]+!![]+!![]]+
                            ([][[]]+[])[+!![]]+
                            (!![]+[])[+[]]+
                            (!![]+[])[+!![]]+
                            ([![]]+[][[]])[+!![]+[+[]]]+
                            (!![]+[])[!![]+!![]+!![]]+
                            (![]+[])[!![]+!![]+!![]]
                        ]()+[]
                    )[!![]+!![]]
                ]()                                                                                                                 // '<sub></sub>'
            )
        )[+!![]+[+[]]]+                                                                                                         // 'NaN/<sub><\\/sub>/'[10] == '\\'
        ([][[]]+[])[+[]]+                                                                                                   // u
        (!![]+!![]+[])+                                                                                                     // 2
        (!![]+!![]+!![]+!![]+!![]+!![]+[])+                                                                                 // 6
        (+[]+[])+                                                                                                           // 0
        (!![]+!![]+!![]+!![]+!![]+!![]+[])+                                                                                 // 6
        ([]+[])[                                                                                                            // '"'
            (![]+[])[+[]]+
            (!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+
            ([][[]]+[])[+!![]]+
            (!![]+[])[+[]]+
            ([]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[!![]+!![]+!![]]+
            (!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+
            (![]+[])[!![]+!![]]+
            (!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!![]+[+[]]]+(![]+[])[!![]+!![]]+(![]+[])[!![]+!![]]])[+!![]+[+[]]]+
            (!![]+[])[+!![]]
        ]()[
            +!![]+
            [!![]+!![]]
        ]
    )+
    (([]+[]+[]+[]+[]+[]+[]+[]+[]+[]))                                                                                       // Padding to 4321 characters
    

    KeroppiMomo

    Posted 2017-07-24T15:48:37.750

    Reputation: 101

    0

    JavaScript (Node.js), programmer5000

    null
    

    ! > Will cause an error "TypeError: Cannot read property 'constructor' of null".

    undefined also works.

    Naruyoko

    Posted 2017-07-24T15:48:37.750

    Reputation: 459