Unscramble the Source Code [robber thread for cracking attempts]

44

4

This is the companion thread to the main Unscramble the Source Code challenge. If you think you have managed to unscramble one of the cop answers, you should post your solution as the answer to this thread.

As a reminder, you have one attempt at cracking each submission. Your cracking attempt will be an unscrambled version of the source code. If your guess matches the description (same characters, output, and of course language), and you are the first correct guess, then you win a point. It is important to note that your program does not have to exactly match the original, simply use the same characters and have the same functionality. This means there could be more than one correct answer.

The robber with the most points (successful cracks) wins.

Leaderboard

Too many solves

20 solves

15 solves

10 solves

7 solves

5 solves

4 solves

3 solves

2 solves

1 solve

PhiNotPi

Posted 2014-11-04T19:45:25.013

Reputation: 26 739

1

Perl 5, size 27, by Morot
  • print'pin'=~tr(a-za)(za-z)r
– None – 2014-11-06T14:34:21.067

@WumpusQ.Wumbley We've all been there... ;) – Martin Ender – 2014-11-06T14:35:12.543

3I refuse to waste my time attempting to appease it. – None – 2014-11-06T14:35:41.953

Given the two question bodies, it appears that the scrambled/unscrambled answers are reversed – Mooing Duck – 2014-11-06T23:31:28.720

Ruby, 23 by MegaTom =
p %++.methods[80][1..-1]
– histocrat – 2014-11-11T22:31:17.797

Ah, now I understand the comments upthread. – histocrat – 2014-11-11T22:42:05.990

Answers

33

CJam, size 20, by Martin Büttner

Hi "petStorm!", mame

Try it online.

How it works

Hi                      "           int(17)                     ";
   "petStorm!",         "                    len('petStorm!')   ";
                ma      "     atan2(       ,                 )  ";
                  me    " exp(                                ) ";
                        " exp(atan2(int(17), len('petStorm!'))) ";

Cracking the code

The desired output, 2.956177636986737, is either a Double or a Double followed by a Long.

Using only the characters in "Stop, Hammer time!", there are four builtin operators that return non-integer Doubles:

  • mS, which is asin
  • ma, which is atan2
  • me, which is exp
  • mt, which is tan

All of them contain an m, so we can use at most three of them. There is only one S and one a.

All of those operators need input, and ma is the only one that consumes two inputs. We have only three ways to push Longs:

  • "...",, which pushes the string's length (strictly less than 18).
  • H, which pushes 17.
  • ...!, which pushes the logical NOT of ....

We have no way of pushing something falsy as ..., so the last option will always push 0.

The output doesn't begin or end with 17 or 0. Since 15 decimal digits is the usual number of digits for a Double, it seemed likely that the output was a simple Double.

Assuming this, the code has to fall in one of the following categories:

  • <Long> <mS|me|mt>{1,3}
  • <Long> <mS|me|mt>{x} <Long> <mS|me|mt>{y} ma <mS|me|mt>{z}.
  • Any of the above, with some cast to Long (i) or rounding (mo) applied to a Double.

In the second case, x + y + z is either 1 or 2 and one of the Longs is 0 or 17.

The rest was basically brute force. After a few tries,

18 , {H \ ma me 2.956177636986737 =} =

returned 9, meaning that

H 9 ma me

produces the desired output.

All that's left is to eliminate all but 9 characters from the string. Spaces are noops and i is a noop on Longs, so "petStorm!" is one of the possible choices.

Dennis

Posted 2014-11-04T19:45:25.013

Reputation: 196 637

1That's insane - how did you figure out what the number was? – Sp3000 – 2014-11-06T04:14:03.573

1I searched the logarithm (and others) of that number but didn't get any result. Now I found I was using too high precision. – jimmy23013 – 2014-11-06T04:32:17.400

2@Sp3000: I've edited my answer. – Dennis – 2014-11-06T04:52:28.560

1Very nice! I should have taken out two more characters from the string I guess. In my original I actually had the spaces still inside the string, but an mr before taking the length. Not that you wouldn't have figured that out as well at some point. ;) – Martin Ender – 2014-11-06T10:30:11.623

25

Python 3, size 12, by xnor

()and bciprt

Does nothing (expression produces an empty tuple, which is not printed). This works due to short-circuit evaluation.

matsjoyce

Posted 2014-11-04T19:45:25.013

Reputation: 1 319

1In Python 3 IDLE, this outputs (). – None – 2014-11-04T21:14:53.610

@hosch250 Since its in a program (a python file), nothing is outputted, as there is no print. – matsjoyce – 2014-11-04T21:15:59.680

I see. I was running from the command line thing. – None – 2014-11-04T21:16:51.840

47...."thing".... – TheDoctor – 2014-11-04T23:21:05.467

Why does this not give an error? – CodyBugstein – 2014-11-07T13:01:11.280

4@Imray Because of short-circuiting - Python loads the tuple and checks if the tuple's value is true, since it's empty, it is false. The code to load the variable bciprt is never executed, so it never produces a NameError. – Mateon1 – 2014-11-10T14:13:21.477

20

Python, size 74, by xnor

any(print(set is
set)for i in oct(chr is
map))and aeeeeeggiilnnpprrrrrstvw

Well that was fun. Thanks to FryAmTheEggman, hosch250 and isaacg for suggestions/helping out.

Sp3000

Posted 2014-11-04T19:45:25.013

Reputation: 58 729

1Nice job! My solution was quite similar: list(\nprint(range is range)for aacdeeeeehmppprrrrssvwy in\noct(int is int)). – xnor – 2014-11-07T01:46:07.967

@xnor LOL that variable name. Is it bad that I would have never thought of that? :P – FryAmTheEggman – 2014-11-07T02:23:23.110

2

@FryAmTheEggman I think everyone was expecting me to use the trick from my first cop.

– xnor – 2014-11-07T02:24:20.710

@FryAmTheEggman Don't worry, you're not the only one :P – Sp3000 – 2014-11-07T02:25:46.883

13

Python 2, size 50, by Geobits

print 2**2**2*2**2-22-2**2**2**2/2**2**2**2**2/2/2

Outputs 42.

Ypnypn

Posted 2014-11-04T19:45:25.013

Reputation: 10 485

1Have a point :) For reference, original was print 2**2**2**2/2**2**2/2**2**2/2-2**2**2*2**2-22, but it's not surprising at all that more than one option is correct. – Geobits – 2014-11-04T20:33:25.807

13

GolfScript, size 13, by Peter Taylor

,22,{.4&?+.}/

Test it here.

Another one, that I only cracked with big help from Sp3000. Thanks!

So here's how we got there. Sp3000 noticed a bunch of runs of consecutive numbers in the output:

1,2,3,4,[2608852181],4582,4583,4584,4585,4586,[253225388392299],
142924,142925,142926,142927,142928,[302928],497409,497409

Based on that we made the assumption, that this was an increasing sequence, which only allowed for one possible splitting of the remaining numbers:

1,2,3,4,260,885,2181,4582,4583,4584,4585,4586,25322,53883,92299,
142924,142925,142926,142927,142928,302928,497409,497409

That's 23 numbers, which was a strong indicator for repeating the block 22 times, as well as ending the block with . (duplicate top stack element), such that the previous result got left behind on the stack and such that the final iteration would appear on the stack twice. That's 22,{____.}/.

Now looking at the gaps, those turn out to be 4th powers (which is nice, because we have 4 and ?). More precisely, they are the fourth power of the index of the current number. So next we looked at which indices created a gap:

4,5,6,7, 12,13,14,15, 20,21,..?

In binary those are

00100
00101
00110
00111
01100
01101
01110
01111
10100
10101

They all have the third bit set, which means that the index is probably just bitwise-and'ed with 4 (which is nice again, because we can make another 4 with . and have a &). This works particularly well, because this operation results in either 0 or 4, and if we use that as the exponent we get either 1 or a fourth power, which is exactly what we need. So let's put that together:

22,{.4&?+.}/

Here is what the block does:

.      # Duplicate current index
 4     # Push a 4
  &    # Bitwise and
   ?   # Raise index to resulting power
    +  # Add to previous result
     . # Duplicate for use in next iteration

Now there were two problems left: we had a stray , we didn't use yet, and the first iteration is a special case, in that there is no value from a previous iteration which we could add things to when encountering +. We found that thanks to an unrelated comment by user23013 who casually mentioned that GolfScript starts out with an empty string on the stack (if there's nothing on STDIN). So we could use that other , right at the beginning to turn that string into a 0, which was just what we needed as the start of the iteration.

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

Spot on. This was inspired by a sequence in OEIS which I can't find now. – Peter Taylor – 2014-11-06T12:29:11.743

3And this is why having a separate thread for robbers is a good idea. Nice job! – Dennis – 2014-11-07T03:52:31.610

11

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

1Bah, beaten by 20 seconds >< – Geobits – 2014-11-04T21:17:55.607

Correct, one point to you (should we have a list with this info on it too?) – matsjoyce – 2014-11-05T07:39:29.513

11

Ruby, size 17, by Doorknob

p 2,%r~n~i=~'*tN'

That was great fun. Thanks to Sp3000 for helping me out with this! And I learned that %r?...? literals can have any delimiters. :)

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

10Props to Doorknob for being insanely misleading with print, only to split it up into p for printing, %r for regexes and i for case-insensitive regex matching. – Sp3000 – 2014-11-05T19:15:49.053

11

PHP, size 49, by bwoebi

print@substr(new exception,+~$$a+=++$$m+$$i+2+n);

That was absolutely mental.

It got to

print@substr(new exception,);

fairly quickly, at which point I needed something that gives -6 after the comma, having $++$++$++$+=$~main$2 left.

The main catch is that $a, $m and $i are all NULL, so using them indirectly in variable variables, means they all point to the same variable. However, PHP seems to be doing some weird things about resolving variable variables. With normal variables you can do things like

echo $a+$a=2;

which prints 4 (the 2 is assigned to $a and then added to itself). But if I do the same with variable variables:

echo $$a+$$a=2;

I get 2, because now the first $$a is evaluate before the assignment.

In the end I managed to force some order by putting some increments on the RHS of the += which had to be evaluated before that addition-assignment. That way I got to 5 which I could then just bit-complement. Still... there are some mysterious things going on, and I have no idea why half the things I tried worked and didn't work.

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

For reference, my original: print@substr(new exception,~$$mn+=2+$$a+++$$i++); – bwoebi – 2014-11-06T01:54:15.417

Btw. I hope all the dollar signs and the fact that all the letters for main were in the string mislead you a lot. Also, a rather unusual method for extracting {main}, I think ;-) – bwoebi – 2014-11-06T01:58:12.580

@bwoebi The main didn't really mislead me, after spotting exception, new and substr. I thought they would just be variable names. It took me a bit to come up with using variable variables and than I spent most of the time on figuring out some order of operations that would actually yield a 5 which I could complement without using another set of parentheses. – Martin Ender – 2014-11-06T02:01:07.510

Well, for next time, if there are more dollars than characters, it usually are variable variables. (In this case I also abused varvars to force left-to-right evaluation.) How long did it take you then to spot the substr new exception? Also by the way, I have deeper knowledge of the Zend engine, so I can perfectly explain to myself why things are evaluated in which order and that's nice for these challenges ;-) If there's a specific thing you don't get, I'll happily explain it to you. – bwoebi – 2014-11-06T02:08:43.533

@bwoebi Come in chat tomorrow, and we can talk about it, but I've spent long enough on this today. ;) As for your first question, exception was obvious, which left stray characters for substr and new lying around. It was literally the first thing I saw when starting to work on it.

– Martin Ender – 2014-11-06T02:12:22.450

9

Ruby, size 38, by Doorknob

[$><<(!$pece60).to_s[rand($win)].succ]

I'm pretty sure this is nowhere near the original source. It's deterministic despite using rand.

Here is how this one works. $><< is just output. $pece60 and $win are undefined global variables, which therefore are just nil (and they allowed me to get rid of some extraneous characters). !$pece60 makes a true and to_s gives the string "true".

For ages, I tried getting a 2 or -2 to access that u in there, but then I realised I could just take the t, and call .succ(essor) on it to make a u.

rand with a nil parameter returns a random float in the interval [0,1). When using floats to index into strings, they get truncated to integers, so this will always return the first character.

Finally, I had a spare pair of [] so I just wrapped everything in it, because thankfully everything is an expression in Ruby.

Thanks to Sp3000 for throwing some ideas around in chat.

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

8Ruby is a scary-looking language. – feersum – 2014-11-08T14:16:42.670

8

C, 51 by es1024

c=0xf.cp9,hhtaglfor;main() {;; printf("%d",(++c));}

After 20 years of programming C today I learned about hexadecimal floating point constants.

Art

Posted 2014-11-04T19:45:25.013

Reputation: 545

8

Ruby, 45 (histocrat)

%q[zyfnhvjkwudebgmaclprs x].to_i(36)/51074892

Woohoo! This is my first crack at a code golf problem, and I don't have enough rep to comment on the original post. I immediately recognized the trick used, since I've actually found use for it in production code often. It took about 5 minutes to figure out most of the structure and a few hours to come up with the complete answer.

Explanation:

  • %q[] is an alternative method for creating strings. Parenthesis and curly braces may also be used.
  • String#to_i in Ruby accepts numbers in any base from 2 to 36. It will ignore the first character in the string which is not part of the number, so any extra characters can be "thrown away" after the space.

And here's the code I used to crack it:

require 'set'

# return true if the string is made up of unique characters
def uniq(s)
  a = s.each_char.to_a
  return a == a.uniq
end

def uniq_while_same(a,b)
  s = Set.new
  a.each_char.zip(b.each_char).each do |ai, bi|
    return true if ai != bi
    return false if s.include? ai
    s << ai
  end
  return true
end

def ungolf(answer)
  # For each base that even makes sense
  [            36, 35, 34,     32, 31, 30,
   29, 28, 27, 26, 25, 24, 23,     21, 20,
   19, 18, 17, 16, 15, 14, 13, 12,     10].each do |base|
    # Ignore bases where it is not possible to create a unique-string number greater than answer
    next if answer > base ** base
    # Pick digits for the denominator that are not duplicates of the digits in base
    denominator_digits = ('1234567890'.each_char.to_a - base.to_s.each_char.to_a)
    # For each permutation of those digits for the denominator
    (1..10).each do |denominator_length|
      denominator_digits.permutation(denominator_length) do |denominator_s|
        # Maybe the denominator is in octal
        denominator_base = 10
        if denominator_s[0] == '0'
          next if denominator_s.include?('8') || denominator_s.include?('9')
          denominator_base = 8
        end
        denominator_s = denominator_s.join
        denominator = denominator_s.to_i denominator_base
        print "#{"\b"*64}(%q[#{(answer * denominator).to_s(base).ljust(36)}].to_i #{base})/#{denominator_s.ljust(10)}" if rand < 0.01
        # Ignore denominators that are definitely impossible to have answers for
        next unless uniq_while_same "qtoi#{base}#{denominator_s}#{(answer * denominator).to_s(base)}",
                                    "qtoi#{base}#{denominator_s}#{((answer + 1) * denominator).to_s(base)}"

        # For each numerator that gives answer when divided by the denominator
        (answer * denominator...(answer + 1) * denominator).each do |numerator|
          print "#{"\b"*64}%q[#{numerator.to_s(base).ljust(36)}].to_i(#{base})/#{denominator_s.ljust(10)}" if rand < 0.01
          # Remove any that are still not unique
          s = "#{numerator.to_s(base)}#{base}#{denominator_s}qtoi"
          next unless uniq s
          # Done. Compute which characters need to be thrown away to fill the remaining space
          remains = ('0123456789abcdefghijklmnopqrstuvwxyz'.each_char.to_a - s.each_char.to_a).join
          print "#{"\b"*64}#{" "*64}#{"\b"*64}"
          return "%q[#{numerator.to_s(base)} #{remains}].to_i(#{base})/#{denominator_s}"
        end
      end
    end
  end
  print "#{"\b"*64}"
  puts "\nnone"
  return nil
end


print ungolf 9410663329978946297999932

Way to go embedding an NP problem inside a riddle. I have been thoroughly nerd-sniped. Good job!

charredUtensil

Posted 2014-11-04T19:45:25.013

Reputation: 81

I added a comment to the original answer for you. – FireFly – 2014-11-14T20:44:57.067

This is awesome (and close to the intended answer), but technically not valid because it doesn't have output. – histocrat – 2014-11-14T20:59:44.627

*facepalm Well I still had fun. – charredUtensil – 2014-11-14T21:29:54.677

2@charredUtensil if you don't mind running your script for some more, I think the printing is just moving the p to before the expression. Presumably the remaining characters can be used to form the constants as you've done. – FireFly – 2014-11-14T21:34:53.163

I don't actually need to run it again. The last few characters of the string can be rearranged without changing the result - p %q[zyfnhvjkwudebgmaclrsx].to_i(36)/51074892 I know I broke my actual cracking attempt though :) – charredUtensil – 2014-11-15T06:32:33.043

7

Python [any] shell size 44, by Caridorc

__name__[3]  or (enfin_____[42], manager[1])

I'm sure there was supposed to be more to it than this, but since __name__ equates to __main__, the 4th character 'a' is selected and the rest of the line is never evaluated.

r3mainer

Posted 2014-11-04T19:45:25.013

Reputation: 19 135

Just for reference the original programme is [__name__ for ___name__ in range(1,4)][2][3] – Caridorc – 2014-11-05T12:47:33.593

7

Perl, size 36, by squeamish ossifrage

$_=rof;for$i(1..2129<<7){$_++}print;

Another difficult one.

grc

Posted 2014-11-04T19:45:25.013

Reputation: 18 565

1Well done :-) That's it exactly. – r3mainer – 2014-11-06T10:03:58.173

@squeamishossifrage Thanks. You had some very nice 'Perl features' hidden in that program. – grc – 2014-11-06T10:22:35.137

7

CJam, size 13, by user23013

G,Cf#If/sE*K%

Test it here.

Solved by hand, like so:

First, some background for non-CJammers:

  • CEGIK are all variables, which are pre-initialised to 12, 14, 16, 18, 20, respectively.
  • s converts the top stack element to a string.
  • Strings are technically just arrays of characters.
  • f is pretty magic. For the purpose of this answer, the simplified version is that, for an array a, some other value b and an operator g, the sequence abfg maps g(_,b) onto a (where each element of a goes into the _ slot).
  • / is division and splitting arrays (amongst other things).
  • * is multiplication and array repetition (amongst other things).
  • % is modulo and some weird operation, which in the form ad% for array a and integer d takes every dth element of a (like Python's slicing with step width d).
  • # is exponentiation (amongst other things).
  • , turns numbers into ranges (from 0 to n-1) and returns the length of an array.

Okay, that out of the way...

It was fairly obvious that we needed , to turn a number into a range, because the only other way to get an array would have been to build a larger number and turn it into a character array with s - but then we couldn't have done any further arithmetic on it. And we need an array to do something with the fs.

I first assumed that the fs were used with # and %, but that would mean we would have needed a number around 90 to get the right amount of digits in the end. And also, this didn't explain what to do with s, and since the answer looked really golfy, I doubted user23013 just appended an s as an effective no-op somewhere to throw people off.

So I figured, maybe he isn't even keeping the numbers small with %, but instead he builds an array of huge numbers, concatenates their string representation with s, but then only picks some odd slice out of it with %. So I played around a bit with the following framework:

__*,_f#_f/s_%

(You can't do _f/ first, because that would yield zero for at least the first 12 elements.)

Where the _ are some permutation of the variables. I didn't try all of them before I got bored, and the main problem with this was that the resulting sequence of digits as always way too long.

At some point it occurred to me, that we wouldn't need such a large range (i.e. the product of two numbers), if instead we used the * to repeat the resulting string. Due to the mismatch of the parameters of * and % this would yield no repetition in the result:

_,_f#_f/s_*_%

This yielded results of a length very close to what I was looking for. I would have actually tried all 240 of them, but fairly quickly (third or fourth attempt), I stumbled upon

E,Cf#If/sG*K%

which yields

03081942753650251594592190492275006661328850322159030034930530649722385533653290754678977

And I figured a match of the first six digits wouldn't be a coincidence. So the question was how to rearrange it without upsetting the actual computation:

  • I couldn't change K because that would pick out different digits altogether.
  • I couldn't change C or I because that would change the numbers resulting from the two map operations.
  • If I changed G that would only change the number of repetitions, which would do nothing but change the length of the result. (Which is good.)
  • If I changed E that would change the range of the array, but the range would still start with [0 1 2 3 ...], so it wouldn't affect the calculation. It would affect the length of the base string returned by s, which would also mean that K% would pick out different digits upon additional repetitions.

So I just tried swapping E and G and voila:

030819828850379075460427536222159187897761502517030034671154875945928930530907551421904962649729

In summary, here is what the code does:

G,            "Push [0 1 2 3 ... 13 14 15].";
  Cf#         "Raise each element to the 12th power.";
     If/      "Divide each element by 18.";
        s     "Concatenate all numbers into a string.";
         E*   "Repeat 14 times.";
           K% "Pick every 20th digit.";

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

7

APL, size 17, by user23013

+(3*3)3,(***)\3 3

I spent far too long trying to crack this. It probably would've gone quicker if I knew APL going in.

Try it out here

Geobits

Posted 2014-11-04T19:45:25.013

Reputation: 19 061

6

Pyth, size 11, by isaacg

:\\w$ ",d,N

That's some mean bug abuse right there. This compiles to:

Pprint("\n",at_slice("\",input(), ",d,N))

The relevant bug is that \\ compiles to "\" instead of "\\", which lets you compile Pyth into a string.

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

Should the Pprint be print, or at least pprint? – FireFly – 2014-11-15T00:56:19.697

@FireFly That's what the debug output stated. Maybe the Pyth interpreter defines its own Pprint? – Martin Ender – 2014-11-15T00:57:56.050

Oh, okay, never mind then. – FireFly – 2014-11-15T00:59:53.803

6

Python, size 69, by Sp3000

print(sum(list(map(ord,str((dict(((str(dict()),list()),)),str()))))))

That was hard...

grc

Posted 2014-11-04T19:45:25.013

Reputation: 18 565

1Nice! For reference, the original was print(sum(map(ord,str((dict(list(((str(),str(dict())),))),list()))))), but obviously a lot of different permutations of keywords would work. – Sp3000 – 2014-11-05T13:01:24.763

2That's a LISP-level of parens there! – xnor – 2014-11-07T02:16:21.470

6

Python 3, 37 bytes, by Sp3000

print(sum(b"a".zfill(len(str(...)))))

Embarrassingly by far the hardest part was figuring out to convert the string into bytes. I had to sleep on it, and in the night realized 'duh, it's a bytes literal!'

Blake Walsh

Posted 2014-11-04T19:45:25.013

Reputation: 163

Ahaha nicely done, I thought the Ellipsis might trip people up but I guess not – Sp3000 – 2014-11-08T00:20:30.457

I saw the ellipsis and zfill, but didn't know about the bytes objects. Those could be useful in golfing arrays of integers! – feersum – 2014-11-08T00:22:07.513

Great job! I only saw the print and the .zfill, and I knew sum might be part of it, but I couldn't solve it. Have a +1. – None – 2014-11-08T00:40:43.090

6

PHP, 53, by PleaseStand

Cracked it at last:

for($d=57,$o=35;$o+$d<999;)$o+=printf("$d%o",$d+=$o);

The solution came quite quickly when I noticed that the sequence consists of alternating decimal and octal numbers:

Dec: 57...92...132...177...228...285...348...417...492....573....661....756....858....
     571349220413226117734422843528553434864141775449210755731225661136475615328581707
Oct: ..134..204...261...344...435...534...641...754...1075...1225...1364...1532...1707
==Dec:  92  132   177   228   285   348   417   492    573    661    756    858    967

Also, the intervals between each set of numbers grew at a rate equal to the value returned by printf() (i.e., the number of characters written).

r3mainer

Posted 2014-11-04T19:45:25.013

Reputation: 19 135

3Wow, nice detective work! – Sp3000 – 2014-11-08T15:28:34.010

6

Python 2, size 132, by Vi.

exec('from string import printable as e\nprint "cqance"\x2Ereplace("q",e[len("fgiillmmooprrsstt")])or ",,,\016:::S[]____tuuvyy" ""')

Thanks for all the backslashes and quotation marks :)


Edit: The updated 96-char version:

exec "try:exec'from __future__ import braces\\nt(12)'\nexcept SyntaxError as q:print(q[0][6:])"

This is taken entirely from Alex's solution in https://codegolf.stackexchange.com/a/41451/32353

kennytm

Posted 2014-11-04T19:45:25.013

Reputation: 6 847

Heh, nice. Wondering what the indended solution was... – FireFly – 2014-11-12T23:28:15.817

This is not an intended solution. The original solution does not have any "throw-away" things like fgiillmmooprrsstt or ,,,\016:::S[]____tuuvyy. – Vi. – 2014-11-13T12:34:41.623

exec? My code chould have been shorter... I was emulating it with compile+eval because of I forgot about exec... – Vi. – 2014-11-13T12:36:50.830

Implemented the shorter version. Try to figure out the original trick. – Vi. – 2014-11-13T12:42:25.137

5

CJam, size 15, by Ypnypn

98,{7%}%{6+}%:+

From the given characters, I guessed it had to be one of the three following forms:

__,{_%}%{_+}%:+
_,{_%}%{__+}%:+
__,{_+}%{_%}%:+

which creates a two-digit range, then maps an addition and modulo operation (in either order) onto the range, before summing it. So I just started with the first one, and systematically tried permutations of 6789 in the gaps.

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

Dammit, I just solved it too :/ – Optimizer – 2014-11-04T21:45:04.963

5

PHP, size 52, by PleaseStand

for(mt_srand($i=46);$i--;)echo chr(mt_rand()%95+32);

This turned out to be quite easy in the end. The output looks very random, and the characters m, t, _, r, a, n and d all appeared twice...

r3mainer

Posted 2014-11-04T19:45:25.013

Reputation: 19 135

5

Python 2, size 61, by FryAmTheEggman

print(dir('~s]l.c:st_''-p_tp.l]-~.:o:Te[_u[.i_')[10][2:][:3])

I'd be very surprised if this matches the original.

grc

Posted 2014-11-04T19:45:25.013

Reputation: 18 565

It doesn't, but congrats anyways! My code was:print''.__doc__[::2][::3].split()[1].split('.')[0][:-~-~True] – FryAmTheEggman – 2014-11-05T04:56:44.473

In hindsight, I shouldn't have included the quotes... ;) – FryAmTheEggman – 2014-11-05T04:59:36.277

@FryAmTheEggman Oh wow - nice program! I was convinced you had at least used dir() to find the 'get'. And yes, it would have been very difficult without the quotes. – grc – 2014-11-05T05:04:33.980

5

Python 3, Sp3000, size 44

print(~(~(()<((),))<<(()<((),))))<<((()<()))

Python 3 helped me here as I was able to cause an error (left-shifting None by something) after printing the answer.

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

Hmm... looks like I was pretty wasteful with my parens. Had print(~(~(()<())<<((()<((),))<<(()<((),))))) originally. – Sp3000 – 2014-11-05T13:49:38.967

5

PHP, size 52, by kenorb

_:@print_r(chr(@++$i+pow(3<<5,1)));if($i<2*4)goto _;

(God, how long it took me to figure what to do with the remaining _r suffix. Until I noticed it was not print, but print_r...)

bwoebi

Posted 2014-11-04T19:45:25.013

Reputation: 1 721

And I don't know how did you figure it out:) Original: _:print_r(chr(3*pow(2,5)+@++$i));if(@$i<4<<1)goto _;. – kenorb – 2014-11-05T18:38:55.030

3@kenorb a) you need to print something, so echo not possible; print remained; b) you need some loop, but for a for loop, there weren't enough semicolons, and well, there's a colon... so probably a label there in combination with goto; c) then it needs an if to abort the goto-loop. Having now X:print($Y);if($Y)goto X; (X and Y being placeholders); d) there's a ++, but no =, so probably some ++$Z from 1 to 8; e) to get letters from an integer, we need chr() (usually) - it was there; f) now I just needed to find numbers 96 and 8 for chr and if. Then fill in placeholders and volià. – bwoebi – 2014-11-05T18:47:20.300

5

PHP, size 54, by Steve Robbins

echo(21<<($$$$$$${$aaaabbbbbbehi==$l&$w^2}^1==1));;;;

Not the original solution, I think.

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

2Haha, that's lovely. I started by fishing out the echo and the while, but then couldn't be bothered to find a loop that produces 42. – Martin Ender – 2014-11-05T18:22:33.123

There was a while in my original. – Steve Robbins – 2014-11-05T19:17:30.867

5

C, es1024, length 70

e='C',f;main(g){Chorkil:f=printf("40%.d",e+e-  -g);}hAx;*hotpoCkats();

The hard part ended up being to keep track of all the unneeded characters...seriously...I had to redo them about 10 times. The only one that worried me was the . but somehow I stuck it in the middle of the printf format string and it became invisible!

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

5

Python 3, size 110, by Sp3000

import sys,io
u=sys.stdout;sys.stdout=_=io.StringIO()
import this
u.write(" ".join(_.getvalue().split()[::9]))

This was a fun one :)

grc

Posted 2014-11-04T19:45:25.013

Reputation: 18 565

5

Haskell, size 34, by Petr Pudlák

main=print(0xb2f3d5^0x7f1f27::Int)

Note that this program must be run on a 32-bit machine. If you want to check that this is the correct program and you have a 64-bit machine, you can use this instead:

import Data.Int
main=print(0xb2f3d5^0x7f1f27::Int32)

It was pretty easy to guess the "frame" of the program main=print(0x<hex digits>^0x<hex digits>::Int). All the magic was in searching for the right way to partition and order the digits. I didn't do very much smart here, just a brute-force search... though I did take care to abuse the fact that some digits were duplicated, there were probably about an equal number of digits in the base and exponent, and the last digit of the base almost certainly wasn't even. The complete search code is included below; it uses the multiset-comb package. The full search takes about 10:33 on my machine (and produces only one right answer, of course).

{-# LANGUAGE NoMonomorphismRestriction #-}
import Control.Monad
import Data.Int
import Data.List (inits, tails, group)
import Numeric
import Math.Combinatorics.Multiset

main = print (searchFor (-1121766947))

searchFor n = do
    nl <- [6,5,7,4,8,3,9,2,10,1,11]
    (l_, r_)  <- chooseSubbag nl digits
    l <- perms l_
    guard (last l /= '2')
    r <- perms r_
    guard ((fromString l :: Int32) ^ (fromString r :: Integer) == n)
    return (l, r)

chooseSubbag n = chooseSubbag' n . group
chooseSubbag' n xss = go (drop (n-1) (concat xss)) n xss where
    go _  n xss | n < 0 = []
    go _  0 xss = [([],concat xss)]
    go [] n xss = []
    go m  n (xs:xss) = do
        (kx, tx) <- zip (tails xs) (inits xs)
        (k , t ) <- go (drop (length tx) m) (n-length kx) xss
        return (kx++k, tx++t)

digits = "1223577bdfff"
fromString = fst . head . readHex
perms = permutations . fromList

Daniel Wagner

Posted 2014-11-04T19:45:25.013

Reputation: 171

5

Javascript, 82, by TrungDQ

b=/v/[0]+' ';b[0]+b[9]+b[6]+b[7]+'v'+b[7]+((0==0)+b)[1]+b[9]+b[4]+b[5]+b[6]+b[2];

Took forever to get the indexes right.

SLuck49

Posted 2014-11-04T19:45:25.013

Reputation: 901

5

C, 43 bytes, FryAmTheEggman

Extremely abusive C code; works in the provided tester. Assumes no command-line arguments are passed (which is the default).

main(ui,abdenprsx){printf(&"%se7en%"[ui]);}

Note that the final % doesn't get printed out (at least in the tester provided by the poster and with my local copy of GCC 4.8; Clang refused to compile this code).

nneonneo

Posted 2014-11-04T19:45:25.013

Reputation: 11 445

Nice. I only didn't do that because I thought it would print the % at the end. – feersum – 2014-11-07T22:04:55.560

1@feersum: yeah, I was a bit surprised that it didn't print. (I'm guessing that it's actually UB, but there's plenty of UB in the program already). – nneonneo – 2014-11-07T22:06:02.203

Ah I thought there would be a way around it. Nice work, though :) I'll add the original to the question... – FryAmTheEggman – 2014-11-08T03:36:52.907

I'd like to hear if my version worked in your environment by the way. I think it mostly avoids UB. – FryAmTheEggman – 2014-11-08T03:42:30.973

@FryAmTheEggman: Fails. My environment (OS X) doesn't define unix. (Your original harkens back to an old IOCCC contest entry). – nneonneo – 2014-11-08T03:53:20.873

Yeah I figured it might not work on a non-unix environment. Yes, I really like that answer, personally :P – FryAmTheEggman – 2014-11-08T03:57:36.503

@FryAmTheEggman: OS X is unix, but I believe they deprecated (then eventually removed) the unix define. – nneonneo – 2014-11-08T04:00:31.827

5

Python, size 41, by Sp3000

xx=x=6;exec("x*=6*6;xx*=x;"*xx);print(xx)

I racked my brains for half an hour trying to get to 6**49 by some combination of x*=6, x**=6, and x*=x, but there were never enough *s. Then I remembered something about squares being the sum of consecutive odd numbers... From there it was easy. ;^)

DLosc

Posted 2014-11-04T19:45:25.013

Reputation: 21 213

Nice! I was actually going for the exec loop x=xx=6;exec("x;xx*=6;x*=x"*6);print(x*xx) but I screwed up :P – Sp3000 – 2014-11-08T07:49:12.163

@Sp3000 I'm glad, because I probably wouldn't have gotten that version! :P That's clever with the semicolon placement--you've just taught me a new Python trick. – DLosc – 2014-11-08T08:09:29.660

5

CJam, size 34, by Dennis

"!,wcoo tkea"Jb" n heyre srwe"Bbma

Other solutions:

"newk,r !ywsre"Bb" e cto aeho"Jbma
"erwy !tro"Jb" knsecew,ho"Bbma  ea
"rese ohro  cn"Bb"!ew,a yektw"Jbma
"sr  k!oore,"Bb"nyeewtwch"Jbma  ea
"nwetkhs yr "Bb"o!eerc w,"Jbma eao
"!,wcoo tkea"Jb" n heyre srwe"Bbma

This is mainly based on Martin Büttner's idea. First assume the solution is either "..."Jb"..."Bbma or "..."Bb"..."Jbma. Then find some small fractions p/q whose tangent value is rounded to that number. Try every k and search for a pair of string which can be decoded into kp and kq. The search program is proven fast in cracking of the previous answer.

At first we have overestimated the probability and started with only two pairs of p and q. Nothing is found. But finally I changed the program to enumerate all possible ps and qs, and it worked.

There should be other ways to generate the two numbers other than kp, kq. But I don't know where to start the search in that case.

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

5

C++, size 192, Arcinde

#include<stdio.h>
#define d double
d i7(int y){return y- -1;}d g(d x,int i){return x?x/i- -g(x*i/4/i7(i),i7(i7(i))):x>x;}int (main)(d***dfffgy){printf("%.15f%",7?g(3,1):0,0.,-0.,0,1,2,2,2,4);}

I used the series for pi from here for which "history books credit Sir Isaac Newton." After making a short program based on that, the main difficulty I had with using the provided characters was that while I used three additions, I had no + available, and was one - short of using all double-minuses. I resolved this by creating a function i7 which subtracts -1 from a number. An unfortunate thing that happened is that I used all the / for division, meaning I had a large volume of unused characters to stick in various spots instead of simply commenting them out.

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

I'm impressed. Props for writing a much shorter pi program than me ;) I used 4(arctan(1/7)+2arctan(1/3)), plus I wrote another function to compute powers. – jcai – 2014-11-08T15:48:30.447

5

JavaScript, size 82, by Ismael Miguel

var v='',i=0;for(;i<(21<<2)-~1;)v+=i^++i;console.log(v+i)//,.13<<=[[[[]]]]iiijnozz

Previous version:

var v='',i=0;for(;i<(21<<2)-~1;)v+=i^++i;console.log(v+i);//,.13<<=[[[[]]]]iiijnzz

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

NICE!!!!! This is the code I had: for(var i=0,v=[],z=[2<<2]+[3<<1];i<z;i++)v[i]=i^~i/-1/1;console.log(v.join('')+i);. I guess that my mistake was that 21<<2 == [2<<2]+[3<<1]. But nice one!!! – Ismael Miguel – 2014-11-08T16:31:26.207

2Your original code has one extra o and one less ;. What happened to that? – jimmy23013 – 2014-11-08T16:49:33.723

Weird................. Thanks for the pointer. I did it by hand, which it resulted in human error. You should update the answer to reflect your catch. – Ismael Miguel – 2014-11-08T18:32:26.930

5

Marbelous, size 36, es1024

9C
Dr=0
^3
+O
+O!!

:Dr
}0
++
/\{>{0

There is no trailing line break, so that we remain at 9.

After another very fruitful discussion session with Sp3000, at last, one of the Marbelous submissions is cracked! :)

I can't really explain Marbelous in the scope of this answer, so if you have no idea what I'm talking about, have a look at this reference.

Let's look at the output first: it's 100 ones and zeros, 8 of them at a time (with some offset in the cycle). This suggests that we have some loop that increments a marble 100 times, and printed 0 or 1 depending on the 4th byte. Both of those are pretty convenient because, starting at 9C (in hex) is 156. Incrementing 100 times overflows, so we can abort the loop with a =0. Furthermore, we have access to the fourth bit with ^3. And if we increment before outputting, then we will also correctly start with 3 ones.

Setting this up was a bit trickier though. Especially, since we got really stuck on the idea of naming the board Or, so that we would have the Ds as hex digits (and we also thought there were two ++ devices). But we just couldn't find a way to add 48 to the 0 or 1 resulting from ^3 (which is necessary to turn them into 0 or 1 characters). But at some point I had an epiphany, and realised that O is 24 in base 36, so we could actually increment by 48 using +O twice.

The rest was fairly simple to deduct from the available characters and the requirement to have no empty cells in the boards. In particular, there is no way to move a marble upwards in this, so the only way to create a loop is horizontally. The clue here was the cylindrical board, which allows you to just constantly push things to the right, until =0 lets the marble fall. This also meant that the ++ device had to go inside the subboard, because you can't prevent it from letting the marble fall.

So in summary:

  • 9C is a literal marble which starts its life at value 156.
  • There is a subboard Dr which takes in a marble, increments it, and spits out the result both downwards and to the right.
  • =0 lets the result fall if we hit 0, otherwise pushes it to the right, and back into Dr.
  • ^3 takes the marble that falls out of Dr and returns 0 or 1 depending on the 4th bit.
  • +O increments by 24 (twice).
  • When the result falls off the bottom of the main board, the corresponding ASCII character is printed.
  • !! terminates execution. This isn't necessary to break the loop (that wouldn't continue anyway), but it swallows the null byte, that would be printed if the 00 marble were allowed to fall off the board. It's important to put the !! in the last row, otherwise the final 0 character wouldn't have time to get printed.

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

5

Python 2, size 132, by Vi.

EDIT: Solved the original given that it didn't use exec at all. For some reason, even though I came up with using compile() to trigger the except in the from __future__ import instead of exec(), I didn't think to use compile+eval for the rest.

eval(compile('try: compile("from __future__ import braces","1","single")\nexcept SyntaxError as q:\n\tprint q[0][6:]',"2","single"))

I'm pretty sure the answer to the hint given "Don't count ones which exist. Count ones which do not exist" is "braces".

How it works: The easter egg import from __future__ import braces triggers a SyntaxError: not a chance. The idea was to catch this exception and extract the last word from it; but you can't use try:from __future__ import braces because from __future__ imports must occur at the top of the file (this is because they aren't really imports, they're directives to the interpreter at compile-time to enable features). This is why you can trigger the exception by compiling the import without executing it. Additionally, to compile the try/except in single-statement mode, you need the \n\t after the except. I'm not sure why this is necessary; it works without the \n\t if you use exec-mode. Additionally, the "1" and "2" aren't strictly necessary; those could be left empty.

EDIT: Cracked shorter variant.

exec('try:exec("from __future__ import braces")\nexcept SyntaxError as q:print q[0][6:]\t\n12')

I'm not sure what to do with the 12\\nt characters. They didn't seem to fit, but putting them at the end like that works fine.

This works on basically the same idea as the original, but leverages exec instead. The second exec isn't strictly necessary, though, since all you have to do is compile the import statement.

Personally, I think it would have been a little more interesting to use StandardError instead of SyntaxError, or perhaps an import sys; and sys.last_value[0][6:], but with the dot in there I imagine a whole lot of other solutions would crop up.

Alex Van Liew

Posted 2014-11-04T19:45:25.013

Reputation: 473

@ale reverse a list with [::-1]. it's [start:stop:step] – undergroundmonorail – 2015-01-07T04:59:38.367

That's about what I had too :/ pretty sure from __future__ import braces was the intended idea. – Sp3000 – 2014-11-13T02:31:09.417

Yeah, me too. I tried a lot of other things, like except StandardError (two too many ds, and one too many rs) and I managed to get an extra x removed by switching to compile() instead of exec(). I also tried stuff like sys.last_value or sys.exc_info() but still nothing. – Alex Van Liew – 2014-11-13T05:10:45.123

Congratulations: from __future__ import braces is the answer. – Vi. – 2014-11-14T02:05:25.303

12 is for [6:12]. I'm not too Pythonic yet... Original solutions are now mentioned in the question. – Vi. – 2014-11-14T02:13:01.890

@Vi. Ah, indeed. [6:12] would do it. What I haven't gotten the hang of is extended slicing; you can do some really weird stuff like [::6] and I have no idea what it does but you can do it. I think you can do [-1:] to reverse a list, although reverse() is a lot clearer. – Alex Van Liew – 2014-11-14T07:14:07.760

5

JavaScript, size 69, by Shawn Holzworth

f=f=(f=0x76f2156a6c[r='toString'](30))+f+f+' '+((0x25a1335*7)[r](30))

That took a while. This should be similar to the original, though the constants are probably different.

FireFly

Posted 2014-11-04T19:45:25.013

Reputation: 7 107

Good job, the original used the same constants. Also just noticed in the original I assign (0x25a1335*7) to f for no reason at all – SLuck49 – 2014-11-14T20:44:30.950

4

Python 3, size 37 by matsjoyce

print(*[_*_ for _ in range(2*2*2+2)])

Let's add some more text so that this one doesn't get auto-converted to a comment.

xnor

Posted 2014-11-04T19:45:25.013

Reputation: 115 687

I ran into the same problem, and as a result Optimizer almost beat me to it. ;) – Martin Ender – 2014-11-04T21:52:06.773

Can you explain the problem where solutions get converted to comments? (I haven't seen this happen, but should I add some text to my solution as a precaution?) – user1354557 – 2014-11-04T23:48:29.470

Err, that's not quite right, as my solution prints the numbers separated by spaces, not newlines. – matsjoyce – 2014-11-05T07:36:47.710

2Whoops, make that print(*[_*_ for _ in range(2*2*2+2)]) then. – xnor – 2014-11-05T07:48:07.560

Yup, that's it. Do you want to put that into the answer? – matsjoyce – 2014-11-05T17:04:18.393

4

Python 2, 29 bytes, by Dennis

emnsssssyyy= str().strip;ord;

Please, good bot, do not convert me to a comment!

xnor

Posted 2014-11-04T19:45:25.013

Reputation: 115 687

1For the record, I was going for import sys;sys.stderr=sys;n(). – Dennis – 2014-11-05T03:10:25.770

4

JavaScript, size 26, by hsl

alert(998|(103>8>0&41>-0))

And some random text to prevent it converted into a comment.

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

Well, that's totally different from what I intended, but it works. – NinjaBearMonkey – 2014-11-04T23:17:35.733

Here's the original solution that was much more complex: alert(-9>>>011&(480|0839)) – NinjaBearMonkey – 2014-11-05T02:51:24.250

4

Python, size 56 by Fox Wilson

print("".join([chr((i+70)^32)for i in (2,3,-70,7,9,7)]))

user1354557

Posted 2014-11-04T19:45:25.013

Reputation: 251

1You have a few stray parentheses in there, but this is the intended solution. – Fox Wilson – 2014-11-04T23:51:47.833

Oops! Fixed.

– user1354557 – 2014-11-05T15:33:41.593

4

C++, 56, by hosch250

int main(){for(int c=33;c<251-124;+4)c+=printf("%c",c);}

Note that in order to get this to compile with GCC as a C++ program, I had to tell GCC to include stdio.h:

$ g++ -include stdio.h -o 40974 40974.cpp
$ ./40974
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

The program does compile without -include in GCC's C99 mode though:

$ gcc -std=c99 -o 40974 40974.c
40974.c: In function ‘main’:
40974.c:1:1: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
 int main(){for(int c=33;c<251-124;+4)c+=printf("%c",c);}
 ^
40974.c:1:41: warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by default]
 int main(){for(int c=33;c<251-124;+4)c+=printf("%c",c);}
                                         ^

PleaseStand

Posted 2014-11-04T19:45:25.013

Reputation: 5 369

2Looks like I'm a little late. I found another version though : int main(){for(int c=33;c<144-22+5;c+=1)printf("%c",c);} which still needs stdio.h. – Ethiraric – 2014-11-05T08:56:54.790

2Approaches with -include should not be considered valid. It's just like claiming a file containing A can have any behaviour you want, by compiling with the appropriate -DA=... command-line option: your claimed "source" file does not include the complete source. – hvd – 2014-11-05T09:24:08.293

@Ethiraric You found my solution, although both are valid. I did not need stdio.h, although I did have stdafx.h. I was told before that I did not need to count that because that is a VS thing. It probably includes stdio.h somewhere in it. – None – 2014-11-05T16:23:06.680

@hvd I am not compiling with a command-line. I am running this code from Visual Studio and entering no extra commands. Also, VS would not even accept -include anyway - I would need to use #include, so would that invalidate my answer too if it didn't work on your computer? – None – 2014-11-05T16:25:13.130

1@hosch250 In my opinion, it's fine that you don't count the contents of the stdafx.h file as part of your source (since it's unmodified from what's provided by the implementation, even if it's copied to your project directory), but it's not fine that you don't count the #include "stdafx.h" line as part of your source if it's needed for your project to compile. FWIW, Visual Studio behaves like GCC in that it does accept your intended answer in C mode without any #include directives, as long as precompiled headers are disabled in the project options. – hvd – 2014-11-05T17:12:56.800

@hvd OK, I get it. – None – 2014-11-05T17:53:04.473

4

Pyth, size 35, by FryAmTheEggman

llo    oCGd"ProgrammingPuzzesandef"

Simply lg(len("Length 22 string")), extra characters disposed of at the front.

isaacg

Posted 2014-11-04T19:45:25.013

Reputation: 39 268

1Yeah, it didn't seem like anyone else was trying. I thought a solution like this might be doable, but the original was lemsPCdPG with the rest in a supressed print string. – FryAmTheEggman – 2014-11-08T15:01:43.027

4

JavaScript, 94, by Shawn Holzworth

v=['0',01,7,8,5,7,8,4,44,11,8,41,1,1+1];a=alert;r='';for(x in v)r+=(a+(1==0))[v[x]]||'h';a(r);

Works only in SpiderMonkey, it seems (i.e. Firefox). This took me forever, and if it was slightly more clever with the indices I think I'd've given up.

FireFly

Posted 2014-11-04T19:45:25.013

Reputation: 7 107

1Very nice. The original works in Chrome and Firefox... though 'fun in the hun' is hilarious. – SLuck49 – 2014-11-10T13:07:59.460

4

Python, size 34, by Sp3000

print(str([{.6,}])[-4])
_=...;__=_

The trickiest part was trying to get rid of the leftover characters. :P

FireFly

Posted 2014-11-04T19:45:25.013

Reputation: 7 107

Yeah that was awkward. Within 3 minutes of me posting I realised that my red herring had backfired. :/ A solve is a solve though, so I'll put up the intended solution was well :) Good job – Sp3000 – 2014-11-11T03:26:21.743

4

C, size 48, by es1024

main(f){f='ma'-lgamma(0xfe.dp9),printf("%d",f);}

I'm very unsure about this one. It depends on implementation defined behavior (character constants with more than one character, see C99 6.4.4.4 point 10), but happens to produce the right result on Linux with gcc and MacOS with clang. Depending on ASCII I wouldn't even mention, but this is so unusual that it feels very dodgy.

Art

Posted 2014-11-04T19:45:25.013

Reputation: 545

That's exactly the original! – es1024 – 2014-11-12T06:41:11.500

4

Ruby, size 35, by histocrat

(_=->h{:shadily.display})[_]||_===_

Interesting, I did not know you could invoke lambdas with ===... I mean... why?

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

Nicely done. Original code was (_=->h{:shadily.display||_})[_]===_. I think the === invocation is because Ruby calls === in case statements under the hood, so you can use lambdas as your conditions. – histocrat – 2014-11-12T15:43:38.367

@histocrat Ah that makes sense. I like your version, too :) – Martin Ender – 2014-11-12T15:46:38.817

4

CJam, size 19, by Ypnypn

923"4593*JJ#%"786*~

Test it here.

That was close... the seven days had already passed, by Ypnypn did not yet claim immunity by releasing the original source.

Explanation

923                 "Push 923 on the stack.";
   "         "786*~ "Repeat that string 786 times and eval it. Just a loop, basically.";
    4593*           "Multiply by 4593.";
         JJ#        "J is a variable initialised to 19, so compute 19**19.";
            %       "Modulo.";

Cracking

I was fairly certain that "_"_*~ was used to make a loop, and that % was used as modulo to keep the numbers small. (We've seen other ways to do that, but I don't think that would have worked here very well, because you couldn't put the result of your computation in a string.).

So first guess I ventured was that the divisor of the modulo could be 1919. Looking up how much that is, it turned out to be on the same order as the desired result (about 4 times the result), which suggested that this is actually a very likely choice. That left only *, so I figured the code would be of the form

 _"_*JJ#%"_*

Where the _ are filled from the numbers. That's *10!/2/2 * binomial(9,2) = 32,659,200* possible permutations. That seemed to be doable by brute force. :)

The only thing that would blow this up is having a large number before the *... with up to 8 digits, it could basically square the number of iterations needed. So I thought, let's limit that to at most 3 digits (which was apprently quite lucky, seeing that solution actually had three digits there). Then I just reimplemented this framework in Mathematica and wrapped it in a loop over all such permutations:

perms = Permutations@{2, 3, 3, 4, 5, 6, 7, 8, 9, 9};
big = 19^19;
Map[
  (
    If[#[[2]] != perm[[2]], Print@#];
    perm = #;
    For[i = 2, i <= 9, ++i,
     a = FromDigits[perm[[1 ;; i - 1]]];
     For[j = Max[i + 1, 8], j <= 10, ++j,
      b = FromDigits[perm[[i ;; j - 1]]];
      c = FromDigits[perm[[j ;; 10]]];
      x = a;
      For[k = 0, k < c, ++k,
       x = Mod[x*b, big];
       ];
      If[x == 500827930823087774653348, Print@{a, b, c}]
      ]
     ]
    ) &,
  perms
];

After about two hours (shortly before completing the full search) this produced

{923,4593,786}

which I was able to verify in CJam. :)

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

4

Python 2, size 69, by muddyfish

import tabnanny as t;print(t.__name__[:3])or((({3:_efisssw[[]][:]})))

tabnanny is a standard Python module, but I am just borrowing its name here to get the "tab" string.

kennytm

Posted 2014-11-04T19:45:25.013

Reputation: 6 847

4

Interactive Python 2.6, 15, MrWonderful

43**(314)/(1+2)

I did some (imprecise) brute force for i and j where math.log(N * j, i) is very close to an integer.

n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

Posted 2014-11-04T19:45:25.013

Reputation: 5 683

Nicely done. I was a bit disappointed in my first attempt, so I thought about how I'd attack my challenge this time. ;-) Thanks! – MrWonderful – 2014-11-14T19:35:49.027

3

NinjaBearMonkey

Posted 2014-11-04T19:45:25.013

Reputation: 9 925

Not exactly what I was going for. I was going for "hello world" print. But good solution! It's hard to come up with something for a challenge like this. – Josiah Winslow – 2014-11-05T01:47:52.727

@JosiahWinslow "hello world!"rn ipt also works. – jimmy23013 – 2014-11-05T05:12:01.590

3

CJam, size 12, by COTO

T1mp!+~[]_^oE

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

3

PHP, 14, by Tryth

aa:a?:a?:a::a;

Tested working in PHP 5.5:

$ php -nr 'aa:a?:a?:a::a;' | wc -c
0

PleaseStand

Posted 2014-11-04T19:45:25.013

Reputation: 5 369

3

Java 6+, 101 bytes, by Rodolvertice

class ou{public static void main(String[]h){for(int t='l'|'s';t>0;t/=2)System.err.append(t+"4"+t);;}}

Outputs to stderr.

Demo on ideon

I figure out the pattern of the output quite easily:

127 4 127
63 4 63
31 4 31
15 4 15
7 4 7
3 4 3
1 4 1

This suggests the tokens /=2, for(;;), t+"4"+t, >0. for is taken from short free;.

The number 127, the 4 ' and | also suggests the use of | with 2 char.

The tricky part is to pick out t from the rest of the code (out -> err, println -> append, class t, the remaining part of short free;).

n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

Posted 2014-11-04T19:45:25.013

Reputation: 5 683

Well done! Nice description too. +1 – rodolphito – 2014-11-05T15:11:42.750

btw the extra semicolon was because in the original i had declared int t outside the for loop :P – rodolphito – 2014-11-05T15:14:08.760

3

Befunge-93, size 17, by user23013

I'm not sure what all that extra stuff on line 2 is doing there...

"@",69+#
>_-/*%pv

Try it out here

r3mainer

Posted 2014-11-04T19:45:25.013

Reputation: 19 135

The original solution was ",96*-/@ "p#v>+_%. It was a mistake leaving a # there. Line 2 was for putting the other ". – jimmy23013 – 2014-11-05T11:39:51.313

3

JavaScript, size 61, by jsh

x=function() {return 1;};alert((typeof (typeof x)).slice(-4))

Optimizer

Posted 2014-11-04T19:45:25.013

Reputation: 25 836

3

BBC BASIC, 187, by Beta Decay

This just prints out a long sequence of ASCII codes:

PRINTCHR$(121)CHR$(111)CHR$(117)CHR$(39)CHR$(108)CHR$(108)CHR$(32)CHR$(110)CHR$(101)CHR$(118)CHR$(101)CHR$(114)CHR$(32)CHR$(99)CHR$(114)CHR$(97)CHR$(99)CHR$(107)CHR$(32)CHR$(109)CHR$(101)

r3mainer

Posted 2014-11-04T19:45:25.013

Reputation: 19 135

3

PHP, Size 30, by Tryth

__halt_compiler();t101hant.net

Just stopping the parser and ignore everything else to have no output.

bwoebi

Posted 2014-11-04T19:45:25.013

Reputation: 1 721

3

Pyth, size 71, by FryAmTheEggman

*tC"y"l"Han Solo: Never Tell Me The Odd
-3P0: Sir, the possibii,... s!"

There have to be a ridiculous number of possiblities here, but this seemed to be the easiest - get 120 from chr('y')-1, and 31 as the length of a string, and multiply. Newline is a super-comment.

isaacg

Posted 2014-11-04T19:45:25.013

Reputation: 39 268

Yeah, that was the idea :) I believe I got it by doing 47*78+54, but I cant find my source right now... – FryAmTheEggman – 2014-11-06T03:52:07.533

3

MATLAB, COTO, size 41

disp(magic(all(cos(eye(rank(now))))))

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

3You cracked that in about 1 20th the time it took me to come up with an actual working anagram. >___< Also, you appear to have posted the answer as a comment in the OP...? – COTO – 2014-11-06T06:50:01.003

@COTO Several people have had this problem I think...apparently there is a secret minimum answer length. – feersum – 2014-11-06T06:51:25.897

Yes, I figured that was the purpose of the lorem ipsum. And the comment in the OP is gone now, so... no worries. – COTO – 2014-11-06T06:53:26.640

3

CJam, size 32, by Dennis

"tb srcr wB!eyo awm ,kheeonae"Jb

Just guess the answer should be something like "..."Jb and then brute-forced it.

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

3

PHP, 33, by kenorb

This one was quite easy:

<?=strlen(highlight_string(0,1));

In case you were wondering, highlight_string(0,1) produces this result (with a total of 52 characters):

<code><span style="color: #000000">
0</span>
</code>

r3mainer

Posted 2014-11-04T19:45:25.013

Reputation: 19 135

3

Bash, size 33, by Debasis

echo shellpower|awk '{print $1}'

Had to ssh into uni to test that...

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

2I got ${pintwk1ar} |echo 'shellpower' – jimmy23013 – 2014-11-06T23:50:05.457

3

JavaScript, size 10, by Chris

{newa:(1)}

That was finally solvable...

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

3

SAS, size 17, by user3490

%put%eval(a>1>b);

Simply evaluates the expression a>0>b left to right (giving the results of FALSE, which is represented in SAS by 0) and prints the result to the log.

(Thanks to Sp3000 for noting I originally wrote a>0>b.)

ConMan

Posted 2014-11-04T19:45:25.013

Reputation: 203

Just formatted the code a tad with the {} button, if you don't mind :) – Sp3000 – 2014-11-07T02:47:20.360

Also, the original code has a 1 instead of a 0. Does this change anything or does swapping 0 for 1 still work? – Sp3000 – 2014-11-07T02:56:39.453

Whoops, I'll fix that. They both return 0, because of the way SAS evaluates the expression. – ConMan – 2014-11-07T05:31:13.993

3

Java, size 70, Rodolvertice

enum n{s;public static void main(String[]acl){System.out.print((s));}}

I had no idea how enums even worked, with a default toString() returning their name in the source code and all, but there were so few non-boilerplate characters available that it was easy to discover.

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

congrats! original used println and a as class name. :) – rodolphito – 2014-11-07T07:19:26.390

@Rodolvertice I didn't use println, because you didn't list a newline as part of the output. – feersum – 2014-11-07T07:49:13.753

3

Python 2, 16, by imallett

Produces no output in Python 3, but outputs "-2" in Python 2. This technically depends on two's complement arithmetic, which is a reasonable assumption on Python-supporting architectures:

eval("\x7eTrue")

r3mainer

Posted 2014-11-04T19:45:25.013

Reputation: 19 135

3

Javascript, size 285, by Beta Decay

alert(String.fromCharCode(65,90))//      """"""(((((()))))),,,......../////001111222222333334666677777788999:========AEGHJLLLMNORTTX[]_aaaaaaaaaaaaaaaabbbccdddeeeeeeeeeeeeeeeeffffghhhhiiiiiiiijmmmmnnnnnnnnoooooooooooooopppppqrrrrrrrrrrrrrrssssssssssssssstttttttttttttuuuvvvwwwwxz

and some newlines after that.

jcai

Posted 2014-11-04T19:45:25.013

Reputation: 973

Well that's one way :) – Beta Decay – 2014-11-07T11:36:25.963

3

Ruby, size 33, by Doorknob

puts [?\[+?*+?]]-[$?..$\]*$$.next

I don't know Ruby and have no idea what does $?..$\ really mean. Apparently $? and $\ are the only things having the same type (or both undefined?) which will not throw an error.

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

@kernigh It's $\. – jimmy23013 – 2015-01-07T16:37:51.650

1$? is the Process::Status from the last call to Kernel#system. $! is the Exception being rescued. Both are usually nil. Your code makes the Range object nil..nil. – kernigh – 2014-11-09T23:01:06.317

3

Python, size 41, by Sp3000

exec("import re\x0Aprint(re.__all__[1])")

Fairly sure this is the intended solution.

nneonneo

Posted 2014-11-04T19:45:25.013

Reputation: 11 445

I had exactly this! But I thought it was wrong because there were left over rs... apparently I messed up counting this. I don't think this is the intended solution because it only works on Python 2. – feersum – 2014-11-07T22:09:47.373

@feersum: It works in Python 3.3 (as noted in the original posting). It fails in Python 3.4 because they added fullmatch in front of search. – nneonneo – 2014-11-07T22:59:35.773

@feersum This was the intended solution. I thought something like that might happen so I tested in 5 different ways, but unfortunately I forgot about Python 3.4. Sorry about that. – Sp3000 – 2014-11-08T02:08:50.233

@Sp3000 At least it gives me a clue about this question...

– feersum – 2014-11-08T02:17:18.297

3

Ruby, size 37, by Rodolvertice

puts 5423187690^2351479806^1523406978

I noticed that the code had exactly three of each digit 0-9, so I guessed the solution would be three numbers that were permutations of 1234567890. Rather than check all of those, I decided to start with numbers of the form 1234500000, xor them, and see if the first 13 bits were correct; if so, then I would fill in the last five digits of each number with a permutation of 67890 and check the final result. The Python 3 script I threw together found this solution within a few seconds.

DLosc

Posted 2014-11-04T19:45:25.013

Reputation: 21 213

1I guess there could be hundreds of solutions to this type of problem, but my original used an octal... I thought it would make it a lot harder, but it didn't. Original: puts 0741605235^7928381406^1254936789. +1 – rodolphito – 2014-11-09T03:34:56.760

@Rodolvertice Yeah, xor by nature has a lot of possible solutions. Interesting about the octal (and the non-even distribution of digits among the three numbers). – DLosc – 2014-11-09T05:23:38.183

3

C#, size ~600, eshansingh1

using System;class Program{static void Main(string[]a){Console.WriteLine("Hello, World!");Console.WriteLine("Other World!");

String c=""+""+""+"wwTxRExpphk=   hckhew@hm.cm hw Csole.Reae how al vod old); ry  statc bool othval try ex) bool retur >catch us Excepton(); } ex) { Excepton(); } { new { { checker) Check(someval); } } catch } Console.rteine(ther } (Exception ystem; usin { finally { catch (Exception new { Console.riteLine(ello @^A-Z0-9._%-@[A-Z0-9.-].[A-Z]{24}$); ain(string[] try Regex.IsMatch(checker, args) static { } } } Exception(Uh rogram bool CopsAndRobbers { oh.);";}}

I found a size of 587 rather than the claimed 604, but it hardly matters as it's all dead weight. I wouldn't have done this as I didn't have any interest in installing C#, except that I noticed that I already had a C# SDK on my computer, and it seemed simple enough to figure out how to print a string without needing to look at any documentation. Oddly string and String both appear to be types.

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

string is an alias for System.String. Similarly, int is an alias for System.Int32, and so on. – Alex Van Liew – 2014-11-14T18:32:06.727

3

QBasic, 42 bytes, by DLosc

A=2+EMOORT
1PRINT"QBasic!"
IF A THEN RUN 1

There isn't WHILE, NEXT, DO, GOTO, GOSUB or CALL, and there isn't a second PRINT or other ways to get a new line. So I must find some other weird control structures.

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

Nice work! RUN is one of my favorite QBasic quirks, and it seemed like a good thing to abuse for this challenge. (The seven garbage characters were originally a comment, REM+TOO... I didn't think of it becoming an uninitialized variable, for some odd reason. Should've left the + out.) – DLosc – 2014-11-10T03:12:57.063

3

JavaScript, 29, by Joe

[,,].join([,,,].join(3))|74*2

Probably not unique, because I didn't really use one join.

So the idea was to somehow find the number with repetition of digits, multiplication and bitwise or. All of those operations increase the resulting number, so I could limit my search to numbers below 181. Conveniently 181 is prime, so the final operation had to be | (I doubted I could get to [1,1].join(8)). So I just looked at all pairs of numbers that I could bit-or to 181, and looked through those that have at least one operand completely from the available digits. One way is 33|148, and the latter could be found as the product of 74 and 2, so here we are.

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

Nice. I went with the slightly more awkward [,,,].join(3)|[,4,].join(7)*2 but I thought making it non-prime might be a bit too unfair. From the speed you cracked it, maybe not :P – Joe – 2014-11-10T16:47:55.130

3

JavaScript, 46 characters, by FireFly

alert(/ordered/.source)
this.    aaeeefnnrstvw

PleaseStand

Posted 2014-11-04T19:45:25.013

Reputation: 5 369

Oh, right.. perhaps I shouldn't have added this. to make it a bit 'harder'. (the original one used this.alert and var theotherletters) – FireFly – 2014-11-10T21:15:03.020

3

JavaScript, size 28, by Shawn Holzworth

var eeivy;((atob['length']))

I guess, that's not what we were looking for... Turns out it's exactly the original. :)

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

1That's exactly it (down to the junk variable name, which is just weird). The eval/atob was a red herring. – SLuck49 – 2014-11-10T21:22:59.457

@ShawnHolzworth Ha, great. The junk variable name is just sorted alphabetically. – Martin Ender – 2014-11-10T21:24:27.997

3

C, 44, Art

n;main(aaa){while(1-printf(&"a%nb"[n],&n));}

Lacking any assignment operators to use for flow control, it seemed a good idea to look for some function which would take an address and write something to it. I found a %n specifier for printf which does this. I think this was the intended general idea. I had to test on ideone because there was some bug in the implementation on my computer where it refuses to write anything after a %n... Something to do with this maybe.

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

Good job, that was fast. I should have used the longer version that also had an assignment and a few more operators as a red herring. Now it's too late because %n is used up as the weird functionality few know about. – Art – 2014-11-11T14:03:49.877

Man, we just talked about %n in my UNIX class recently too. I couldn't really fathom a good reason to use it. Now I know: golfing. – Alex Van Liew – 2014-11-14T19:19:42.573

3

JavaScript, 42, by Shawn Holzworth

(function nn(n){return !n||n+nn(--n)})(58)

And to test it :

alert((function nn(n){return !n||n+nn(--n)})(58))

Optimizer

Posted 2014-11-04T19:45:25.013

Reputation: 25 836

Good job, that's pretty much the original. – SLuck49 – 2014-11-11T16:45:45.547

1Only difference was the location of the decrement: (function nn(n){return !n||n--+nn(n)})(58) – SLuck49 – 2014-11-11T16:50:18.973

Ah, didn't think of that .. – Optimizer – 2014-11-11T16:51:41.900

3

Java, 134, Olavi Mustanoja

class Shit{public static void main(String[]rtr){for(int n=74;n<=84<<19;n=n<<3^911-'g')System.out.print(""+(char)94+n+(char)(5<<1));;}}

At the beginning I checked the logarithms of the numbers and noticed that the later ones differed by almost exactly 3 log 2. Then it was easy to find that excluding the first number, the next could be obtained by (n << 3) - 728. Instead of the subtraction, an xor operation can give the next number for all of them.

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

1Gotta love the class name. Good job :) – Olavi Mustanoja – 2014-11-11T23:22:08.470

3

JavaScript, size 73, by Mig

alert([o=(eval.e+'(((()))),-....0cceefgillpprrrssst')[2],o].join('enie'))

Thanks for the string literal to dump all the excess characters in! I'm pretty sure this is an unintended solution, but it seems to work nonetheless.

FireFly

Posted 2014-11-04T19:45:25.013

Reputation: 7 107

Well done ! Here is my original code : alert(([].g+[]).split(o='').reverse().slice(0,-2).join(o).replace('f',o)) – Michael M. – 2014-11-14T09:05:45.283

3

Marbelous, 48, by es1024

@110&1
@0@111
@011..
\/=0..

:.-
}0}0}0
{0&0-0<<

So what's the challenge?

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

Ah, I forgot that " is 22 in hex. – es1024 – 2014-11-15T09:14:55.043

3

Marbelous, 55, by es1024

1111
11<<
10/\
10
10
&0..&0

:--.....01=@@@@}}
{0}00000

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

3

Python 2, 13 by Emil

print (070-7)

I'm not sure either why Python has octal literals. Ruby has them too, I was thinking of including one in a puzzle myself.

histocrat

Posted 2014-11-04T19:45:25.013

Reputation: 20 600

That was fast. :) Until today I had never seen octal literals written with a 0 prefix. It somehow seems like a bad idea. – Emil – 2014-11-19T21:07:50.113

2

NinjaBearMonkey

Posted 2014-11-04T19:45:25.013

Reputation: 9 925

Oh wow... I forgot two characters in my answer... there were supposed to be two " as well. And I didn't think test would work on arrays. ^^ But thinking about it, even then it's fairly simple to create a solution that's not the intended one. I was actually going for alert "eehs ".test /[]/. – Martin Ender – 2014-11-04T22:06:37.233

2

JavaScript, size 13, by Caridorc

{}-[]+[]+([])

I'm not sure though if the cop's submission is valid, because it requires a REPL environment.

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

2

CJam, size 18, by Ypnypn

987"12268*"0*~543%

Probably not the original solution.

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

For the record, the original solution was 458"792*602%"813*~ – Ypnypn – 2014-11-05T01:35:10.200

2

Python, size 154, by Fox Wilson

print("".join(chr(int(130-o))for o in [51%35,13,ord("         (()),..////00188==[]________aaccddeeeeffffgiiiiiiiiijjjjllnnnoopprrrrttuu"[1]),sum([8,1])]))

This is almost certainly not the intended solution.

Sp3000

Posted 2014-11-04T19:45:25.013

Reputation: 58 729

Nice! For reference, the intended solution was: print("".join([chr(i) for i in __import__("functools").reduce(tuple.__add__,[[(j,i//j)for j in range(i//115,0,-1)if i%j==0][0] for i in (13338,11858)])])) – Fox Wilson – 2014-11-05T13:24:10.627

@FoxWilson I think if you specified Python 2, I'd have less characters to play around with from the reduce :P – Sp3000 – 2014-11-05T13:35:04.453

2

Python, size 54, by kgull

'head'#(o)op'/r),2\x'12.)w/)],c'dp*((rx:(h('r'ol'e)[re

This most likely is not the intended answer, but it works; the # comments out everything but the result. The OP stated that this is supposed to be run in a shell, so there is no print statement.

NinjaBearMonkey

Posted 2014-11-04T19:45:25.013

Reputation: 9 925

2

Perl 5, size 47, by chilemagic

print((0..$])x$]); ""."$$$$()**.///[[~==1fors";

I think this is valid. The $] part took me a while.

grc

Posted 2014-11-04T19:45:25.013

Reputation: 18 565

2

Python, size 48, by kgull

print('h'+hex(ord('\r')*pow(ord('#')//2,2))[2:])

Sp3000

Posted 2014-11-04T19:45:25.013

Reputation: 58 729

2

PHP, size 22, by kenorb

echo(1.*0+(int)(7.1));

Or something like that... it's not really unique.

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

Great job, it was echo(int)((.1+.7)*10); – kenorb – 2014-11-05T14:14:58.987

2

Python 2, size 38, by FryAmTheEggMan

print(`[].__iter__`[::2].split()[-~1])

Taking letters from object at.

Sp3000

Posted 2014-11-04T19:45:25.013

Reputation: 58 729

Congrats! also, Curses! ;p I also just noticed that 2 == -~1 which was probably not the best idea :S – FryAmTheEggman – 2014-11-05T15:10:23.290

@FryAmTheEggman Ahaha was this not the intended solution or something? – Sp3000 – 2014-11-05T15:17:46.540

No this is exactly what I had, it just didn't matter where you put 2 or -~1. I probably should have also done something like [30].__iter__ to make it more confusing... – FryAmTheEggman – 2014-11-05T15:20:04.523

@FryAmTheEggman Ahaha that wouldn't really change much though, seeing as the repr is still the same – Sp3000 – 2014-11-05T15:21:55.463

Yes, the point of that change would be to make guessing how I chopped the string more difficult, but I guess it probably wouldn't have changed much. By the way, did the `` give it away? – FryAmTheEggman – 2014-11-05T15:27:26.783

@FryAmTheEggman And the ____. I found iter by anagramming, and what remained was split, so it just came together. – Sp3000 – 2014-11-05T15:31:19.267

2

C - 43, by Allbeert

This solution really ,sux, but it does actually work if you ignore the grumbling from gcc:

main(){printf(&__DATE__[10],1+1+1+',sux');}

(It will stop working in a few weeks, however...)

r3mainer

Posted 2014-11-04T19:45:25.013

Reputation: 19 135

Nicely done! I realized printf worked as well as puts (intended solution) after I had posted the code. I also didn't know you could use single quotes for more than one character without an error! Learned something today :) – Allbeert – 2014-11-05T16:55:16.867

2

PHP, size 23, by bwoebi

echo@$c=b,$b.$$c=$c.$c;

I'm confused by why echo@$$c=b,$$c.$$cc.=b; doesn't work, while calling echo@$$c=b,${""}.$$cc.=b; directly does.

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

2Interesting, I had echo$$c=$c.$c=@b,$$c.b; – Martin Ender – 2014-11-05T17:53:22.753

1My original was echo$$c=$c.$c=@b,$c.$b; ... tiny difference to that one from @MartinBüttner – bwoebi – 2014-11-05T17:58:10.903

1I can tell you why echo@$$c=b,$$c.$$cc.=b; doesn't work. in case of an expression (variable variables are considered as an expression), operands are evaluated in order. If there are simple variables, they're evaluated only when the operation between the two operands is done. $a.$a=1: $a is here only fetched when the concat operation has to be done, means after $a=1 was executed. But for $$a.$$a=1: $$a is an expression (as opposed to $a being a simple variable) is then evaluated just in order and only then $$a=1 is evaluated, ending up with effective NULL.1 == 1. – bwoebi – 2014-11-05T18:10:55.593

And also, ${""} can be reduced at run-time to a variable, so it's not considered like an expression. That's all. – bwoebi – 2014-11-05T18:14:18.713

2

Ruby - 58, by Rodolvertice

There are probably lots of solutions to this one.

puts 0x7d556657^0x3ffd88f9^0x1221442e^0xdd48ad1^0x08c58a00

r3mainer

Posted 2014-11-04T19:45:25.013

Reputation: 19 135

Brute force? Original: puts 0xfd469501^0xd62f105d^0x4881d05^0xf7537e82^0x8d2a4c8a – rodolphito – 2014-11-06T00:19:26.480

@Rodolvertice No, just figured it out in a text editor – r3mainer – 2014-11-06T00:29:55.093

Wow. You just did trial and error until it worked? I would never have that patience haha... +1 – rodolphito – 2014-11-06T00:34:37.680

2@Rodolvertice It wasn't trial and error – r3mainer – 2014-11-06T00:45:45.883

2

Perl, size 39, by GentlePurpleRain

$_=(~0);s/(\d\d)/ge_$2/;print$_=chr$1*4

With help from chilemagic.

grc

Posted 2014-11-04T19:45:25.013

Reputation: 18 565

That's valid, but the original was $_=20;$_=~s/(\d\d)/chr($1*4)/ge;print$_ – GentlePurpleRain – 2014-11-06T15:14:09.463

@GentlePurpleRain your original outputs P when I run it, in your answer you said it outputs H. – hmatt1 – 2014-11-06T15:54:56.573

It appears you are correct. It originally started with $_=18, and I changed it at the last minute, but apparently didn't update the output. I'm glad you were able to find a solution nonetheless. – GentlePurpleRain – 2014-11-06T22:53:48.973

2

JavaScript, length 32, by hsl

Interesting use of the map() function there:

[atob('cHVHaVht')].map(alert)//+

r3mainer

Posted 2014-11-04T19:45:25.013

Reputation: 19 135

1Or couldn't you just comment the map stuff out and alert the string directly? – feersum – 2014-11-06T09:43:48.837

@feersum Hah, that never occurred to me :-P – r3mainer – 2014-11-06T09:56:23.137

Nice one! In my quest to have it start with valid code, I never thought of using alert directly. +1 for getting the more complex answer. – NinjaBearMonkey – 2014-11-06T12:49:59.220

2

JavaScript, size 47, by palerdot

alert("a surprise!")//if("est")(it will tell  )

This was super easy though. There can be so many solutions to this too.

Optimizer

Posted 2014-11-04T19:45:25.013

Reputation: 25 836

This is not my original code, though a lot of variations exist for this particular snippet. My original snippet does not contain any comments. – palerdot – 2014-11-06T11:14:52.530

1Heh, I find the runnable code snippet quite amusing; it's not exactly very difficult to predict what it will do. :P – Doorknob – 2014-11-07T01:16:45.747

@Doorknob In a simple case like this, yes. Not when the whole compiler is present there. – Optimizer – 2014-11-07T07:15:57.733

2

PHP, size 44, by kenorb

$_=get_class_methods(@new phar);die($_[70]);

IMO, that one was pretty obvious (took me 10 minutes after first look).

I did a quick google search and observed that there were a lot of class having valid() as method... An coincidentally get_Class_methods() was in the string. After extracting that one, no issues anymore.

bwoebi

Posted 2014-11-04T19:45:25.013

Reputation: 1 721

2

C, size 30, Ethiraric

main(){printf("%d",__LINE__);}

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

Wow, didn't expect it to be that fast :) It is __LINE__ though, not LINE. I used gcc to compile it, don't know if it is different on other compilers – Ethiraric – 2014-11-06T15:26:39.650

1@Ethiraric it is __LINE__ of course, but the site mangled it. – feersum – 2014-11-06T15:59:48.570

2

CJam, size 19, by Martin Büttner

"hunt !tacos" 'hiCt

This one seemed easy...

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

3That was quick. – Martin Ender – 2014-11-06T15:46:14.213

2

PHP, 21, by kenorb

This one is easy if you know that one of the new features in PHP 5.6 (the version of PHP the code was tested in) is a ** operator for exponentiation:

<?=27**5;///***134689

Or alternatively:

<?=3**15;///***246789

PleaseStand

Posted 2014-11-04T19:45:25.013

Reputation: 5 369

2

C, size 39, imallett

_;main(){putchar(_^'_');_++<9&&main();}

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

Almost character for character identical to the original (my ^ arguments are swapped). +1, as this was sortof nasty. I'm curious about how > would have helped? – imallett – 2014-11-07T06:39:15.560

@imallett Actually it wouldn't have--I really was thinking <=. My first idea was something with just one statement like ;_;main(){_<=9&&main(putchar(_++^'_'));} although I guess that seems more convoluted than the actual solution. – feersum – 2014-11-07T06:47:56.000

@feersome: [N.B. GraphicsResearch|->imallett] I actually tried for a while to get a single statement inside the putchar, but couldn't figure out a nice way (precedence kindof kills it). – imallett – 2014-11-07T06:52:29.240

2

Little Man Computer, size 63, The Wolf

503902000051000000000001111122223334455555666777888999999999999

If I'm understanding this correctly, all I have to do is put the number in the out box and then halt? OK...

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

2

Haskell, size 42, by proud haskeller

{data S=S{}deriving Show;main=print S;S=S}

Some clever things were done here: the empty record in the definition of S to reduce the number of spaces (this confused me a long time!), and it looked awful hard to use that extra equals sign from the extraneous S=S equation.

Daniel Wagner

Posted 2014-11-04T19:45:25.013

Reputation: 171

I didn't know you could group top level definitions together. I intended it to be an empty record pattern S{}=S. Should have had two more parentheses. – proud haskeller – 2014-11-07T11:00:28.967

I actually just thought the record definition would be harder to guess. – proud haskeller – 2014-11-07T11:37:27.917

2

Lua, size 28, by ChipperNickel

a=math print(a.asin(1)*a.pi)

Wow, this was actually really simple, why did I not try this earlier? Also, I learned that you can separate statements with nothing but a space in Lua.

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

2

Mathematica, size 18, by Arcinde

D[2#&@d!!,d]/.d->0

That was quite interesting. :)

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

Dang, nice job. – jcai – 2014-11-07T12:13:21.743

2

Ruby, 49, by Doorknob

$><<"'"+'
""'


%''
%''
%"'<<<<<<<<>>>>>>>>>% ?;"

I think I found a tiny shortcut?

Lynn

Posted 2014-11-04T19:45:25.013

Reputation: 55 648

2

Python (2), size 41, muddyfish

print(sum(map(ord,repr(exit.__repr__)))) 

I observed the result 6831 from this code for both Pythons 2 and 3 on my local machine. However, I managed to reproduce the output 6314 with (http://ideone.com/700qVt). Ideone's Python 3 didn't even recognize the exit function.

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

2

C, size 53, by FireFly

s(x){return x?x*s(~-x):!x;}main(){printf("%x",s(9));}

Nice factorial program :)

grc

Posted 2014-11-04T19:45:25.013

Reputation: 18 565

2

Arithmetic, size 31, by Cris

(((((2*2+1)*2+1))*(1+(1+2)*2)))

This may not have been the intended solution because of the unused parentheses, or maybe they were red herring.

NinjaBearMonkey

Posted 2014-11-04T19:45:25.013

Reputation: 9 925

I think that this was the intended output: ((((2*2)+1)*2)+1)*(((1+2)*2)+1) But the functionality is the same. Great catch! – Ismael Miguel – 2014-11-08T06:48:57.987

2

Cris, ECMAScript, 66

eval(atob("J2slzzuuuspmlkihgccbbbaZZYYWSSKKKED995555222S2AnCjsx"))

...

Cris, ECMAScript, 70

eval(atob("DScg12224599ACDDMMNNNOQQTTYZZbcgjklmpssuuuwwyzzzOScKMSY1"))

......

Sp3000

Posted 2014-11-04T19:45:25.013

Reputation: 58 729

2

Python 2, muddyfish, 37

print(memoryview(str(Ellipsis)).ndim)

I'm glad I made that Python builtins anagrammer.

Sp3000

Posted 2014-11-04T19:45:25.013

Reputation: 58 729

2

Java, 108, durron597

class o{{ }public static void main(String...r){System.out.printf("%.6f",('a'*'+'/'\t'-'l')/('m'+'\n'-6.));}}

This was my second pi-printing program today. Given the low precision of this one, the second-most famous rational approximation, namely 355/113, was sufficient to produce the correct digits. It seemed like this fraction should be obtainable with some math on character literals. After some trial and error I finally found an expression ('a'*'+'/'\t'-'l')/('m'+'\n'-6.) which used all the characters it needed to. One convenient thing was that I had the choice between printf or format which both behave identically here.

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

Nicely done. It's quite different from my original though (which is also just math on character literals), which has no wasted {}, for example. If you want to try to figure out mine, my hint is that it's class pi{public static void main(String...lnr){. Perhaps the answer set would be smaller with class z and String...z – durron597 – 2014-11-08T19:34:20.827

2

QBasic, 37 bytes, by DLosc

PRINT 1E7 AND 11053811

R=LEN("*?RY")

I immediately noticed that all the letters of AND were present in the code. (In QBasic, the Boolean operators are bitwise, and true is -1.) Then I wrote a script to find possible combinations of operands by brute force, ignoring zeros to allow for E notation. Once I found a usable combination in the list, all that was left was to deal with the remaining characters.

A single space is printed before the number (where the minus sign would go for a negative number). The scrambled code also prints a space before the number it prints, and that is not described as part of its output, so I assume that that detail is insignificant or was mistakenly omitted.

PleaseStand

Posted 2014-11-04T19:45:25.013

Reputation: 5 369

My original actually multiplied two numbers before ANDing the result with 1E7 (thus the *), but I guess with bitwise operators there's always going to be lots of possibilities. Nice work! – DLosc – 2014-11-11T02:07:46.127

2

PHP, size 46, by Ismael Miguel

$i=az;echo++$i,nd;$i[((E<<H)<=$m&oorrYYz)^$f];

Quite sure this isn't the intended solution.

Turning off notices is recommended for running this.

$i is first set to az, then incremented, which yields ba.

echo can take a list of strings to print; here it prints $i(ba), and then nd.

The rest of the code ($i[((E<<H)<=$m&oorrYYz)^$f];) does nothing.

es1024

Posted 2014-11-04T19:45:25.013

Reputation: 8 953

Greetings dude. After all this time, I've noticed you misspelled my name. Can you please fix it? – Ismael Miguel – 2015-01-11T22:59:23.187

@IsmaelMiguel Sorry about that, fixed. – es1024 – 2015-01-11T23:01:09.420

Nice one! At the moment, I don't have the solution I had. The coma (, char) was my mistake on this one. I used it to make a "pretty" runnable scrambled code. In 40m I post the intended answer. – Ismael Miguel – 2014-11-10T12:55:13.673

I'm sorry for the delay in providing the answer I had. I completely forgot when I went home for lunch. – Ismael Miguel – 2014-11-10T16:10:37.227

This was the intended code: for($z=rand,$i=H<<EY;$i<(m^Y);)echo$z[$i++]&o;. – Ismael Miguel – 2014-11-10T20:29:46.923

2

Python, size 55, by FireFly

____acdfiimmnooprrt={2:.9,}
print(801**sum(range(5))+1)

The funny thing is, my initial solution only worked on Python 3 and it was only until FireFly pointed out that I should inline my 801**sum(range(5)) instead of assigning it to a variable that I got this working for both Python versions.

Sp3000

Posted 2014-11-04T19:45:25.013

Reputation: 58 729

2

Java, Size 97, Olavi Mustanoja

class _{public static void main(String[]s){for(int b:"534g".getBytes())System.out.write(b^'m');}}

There are not too many possibilities with only 1 character ^ usable as operator and lack of p (for printing operation).

I wither the input down to 345_gsm and do some math to map it to the output.

n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

Posted 2014-11-04T19:45:25.013

Reputation: 5 683

2

Ruby, 23 by MegaTom

p %++.methods[80][1..-1]

Edit: So that's where the answer went. Converting back to an answer, hopefully. Thanks for specifying an interpreter, methods[80] is definitely version- and implementation- dependent. Using + for the percent-string delimiter is a nice touch.

I think I found this easier than I would've just because I'd been thinking of doing some similar tricks.

histocrat

Posted 2014-11-04T19:45:25.013

Reputation: 20 600

2

Ruby, size 17, by Stephen Touset

$><<$-W?$?:$:>-pi

Test it on ideone.

Most certainly not the original code. $-W is the value of the command-line argument -W (warning level) which defaults to 1. The rest is just to get rid of the other characters, so I'm putting some undefined variables and operators in the else branch of a ternary.

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

1My original was $-p??:>$i:$><<$-W. I wanted to use the $><< trick, and the (very not well-known) flag-based globals like $-W. Unfortunately, that's short enough (7 characters) to be easily brute-forceable. I rationalized that it might be tricky to include the letter p as a red herring, and the rest was there to reduce the effectiveness of brute force. – Stephen Touset – 2014-11-13T19:32:19.817

2

Python, 37, MrWonderful

print 4123.*3
" +++3:==deefinorsuu"

Probably not intended solution, but this solution is so obvious that I can't help.

Python 2 assumed.

n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

Posted 2014-11-04T19:45:25.013

Reputation: 5 683

That was not, in fact, the original code, but it is close enough. I commend your brevity! ;-) – MrWonderful – 2014-11-14T17:51:42.867

2

J, 25, Caridorc

echo 3%##++-/-/i.!/i.3345

There has to be many ways of getting rid of the extra characters...

FireFly

Posted 2014-11-04T19:45:25.013

Reputation: 7 107

2

C, 19, by Olavi Mustanoja

int main;retunr(){}

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

2

C - size 33, by Olavi Mustanoja

#define p 2+57
main(){return p*p;}

Returns 2 + (57*2) + 57 = 173

r3mainer

Posted 2014-11-04T19:45:25.013

Reputation: 19 135

2

Javascript, 35 (36?), by user3863227

Too easy. After I took out Math and alert, log was the only option.

l=Math.log;alert(l(l(l(1234))));1279

(By the way, I counted 36 characters, not 35.)

r3mainer

Posted 2014-11-04T19:45:25.013

Reputation: 19 135

2

JavaScript, 10, by Jamie Barker

btoa(self)

There weren't that many options...

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

1

Mathematica, size 29, by Fox Wilson

$PrePrint=Function[{x},5];
2+2

Learned something new today! :) ($PrePrint)

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

You're missing a pair of curly braces, but it's pretty obvious where they go (around the x in the Function definition) -- hopefully OP won't mind. – Fox Wilson – 2014-11-04T22:05:35.893

@FoxWilson Oh, sorry, thanks for letting me know! (They can also go around anything in the final line, or the entire first statement.) – Martin Ender – 2014-11-04T22:09:37.313

todat? today? – TRiG – 2014-11-06T18:05:00.533

@TRiG I have no idea what you're talking about. ;) – Martin Ender – 2014-11-06T18:06:46.027

1

Lua, size 18, by user3155415

print(3<math.huge)

I actually haven't tested this, but it should work.

NinjaBearMonkey

Posted 2014-11-04T19:45:25.013

Reputation: 9 925

1

CJam, size 52, by user23013

33,33,33f+:cm*33)%",,,:::')@\&++++3333333333cfffff";

Test it here.

Thanks for providing "...";. ;)

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

The intended solution was 33,33,33f+:c)",,,fffff:::'&"+;+33*33%33\33@33)m33++c. (Note that it has two redundant 3s.) Using m instead of - seemed to be a bad choice. And yes, those ,:fs are supposed to be only misleading. – jimmy23013 – 2014-11-05T09:19:01.557

1

PHP, size 13, by kenorb

@die(_(abc));

I have no idea what _(...) does. Now I do.

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

Me either (re: _). The org was: die(_(@abc));, you're too quick. – kenorb – 2014-11-05T14:44:55.997

1

Python 2, size 57, by FryAmTheEggman

print''.join(map(chr,(40+58,90+4+10+0b100,113+4,101++0)))

The ++ is a lazy way to get rid of a +.

Sp3000

Posted 2014-11-04T19:45:25.013

Reputation: 58 729

Nice work! This was the original: print''.join(map(chr,(0140+0b10,0143+9,0105+48,++++101)) – FryAmTheEggman – 2014-11-05T21:08:58.357

1

PHP, size 27, by kenorb

$_=hex2bin(7069);die($_());

(hex2bin(7069) evaluates to "pi" which is then called)

bwoebi

Posted 2014-11-04T19:45:25.013

Reputation: 1 721

@kenorb woops, that was badly copied. – bwoebi – 2014-11-06T17:14:01.710

1

Mathematica, size 35, by Tally

$PrePrint=$Pre=e=p=esPrint&''    ;a

Definitely not unique. Basically, I'm creating a constant function, take the second derivative (which is a constant-0 function) and make sure that function is applied to any expression that is evaluated or printed. Then I evaluate a.

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

Yeah, I figured it probably wasn't unique... Still it was fun to try and mess with parts of mathematica I hardly understand. My code was: $PrePrint = e = s' &; $PrePrint = p = e' – Tally – 2014-11-06T02:26:04.650

1

Brainfuck, size 118, Sp3000

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

Brainfuck is really not so bad, as long as it's not golfed too much. Since the alphabet is so limited, you can write whatever program you want as long as it's shorter than the original, and then make slight adjustments to balance the symbol counts.

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

Indeed :) Maybe I should have made the string longer, but I'm not sure how much that would have helped. Didn't want the program to be too long though. – Sp3000 – 2014-11-06T09:58:36.860

1

JavaScript, size 25, by Cris

alert.apply(self,[alert])

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

1

JavaScript, size 29, by Cris

new Event("flushPs15").CHANGE

Works in the console.

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

1

C, size 28, Mig

main(s){s=2189640;puts(&s);}

Depends on the endianness of the system.

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

Lorem ipsum dolor sit what now? – r3mainer – 2014-11-06T16:11:01.830

Validated here : http://ideone.com/xpokuO

– Michael M. – 2014-11-06T16:13:25.400

@squeamishossifrage It's probably Bayesian poisoning.

– kenorb – 2014-11-06T19:37:58.883

@feersum If you don't pasting any rubbish into your posts intentionally, please check your computer for any viruses or adwares. – kenorb – 2014-11-06T19:45:39.640

1

@kenorb He was probably trying the avoiding rivers problem as well :D

– Optimizer – 2014-11-06T19:53:54.980

@Optimizer Ah, multitasking... – r3mainer – 2014-11-06T19:55:45.273

1

JavaScript, size 26, by Cris

eval("new function $(){}")

Tested in Chrome's console.

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

1

Python 3, size 46, hosch250

(print("'(otlotb)'")
==
'bffiilnnoopprrrr01*')

I don't think the idea is to let me simply print the output string in a plain literal...

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

This is my original program: f=bool;prin="'(otlotb)'"*f('01');print(prin). Replace the ; with newlines. – None – 2014-11-07T02:02:46.317

BTW, user23013 is correct - you need to move your parenthesis from the garbage statement to the output statement. – None – 2014-11-07T02:03:45.690

1

Java, size 226, nhhhhtdh

enum
u{u;public
static
void
main(String...a){
System.out.print(0x17+68+"\u0020\125nmatched closing \u0027)\u0027u\"((()),.00008;DEIPP\\aaaaaaaacccceeeeeeeeefgiiijlnnooppprrrrrsstttttttttuuuvxyyz{{}}".split(u.toString())[0]);}}

A quick search revealed that it was easy to generate a PatternSyntaxException with the message Unmatched closing ')', but it proved to be unnecessary as the abundance of backslashes, us and digits allowed me to create any character I didn't have via escapes.

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

Not the intended solution, but I did expected it to be cracked in other ways. Maybe I shouldn't have used too many \ – n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ – 2014-11-07T08:47:36.047

1

Python 2, size 89, Beta Decay

   ''''''''((()))*,,,,...12;;=BFGGIIIILPRaaaaaabceeeeeeffgggggiiiiiklmmmmmmnnoopprrrsttvw

Really I would recommend to output something........

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

1

JavaScript, size 30, by Qwertiy

with(Math)alert(max^min)

Interesting use for with. :)

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

1

JavaScript, 41 bytes, by Ismael Miguel

(function(){return this})('ccnoorrsttu.')

Tested in Chrome's console.

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

This wasn't what I had in mind, but was this function(){}.constructor('return this')(). I guess it was too easy. – Ismael Miguel – 2014-11-08T11:43:34.870

1

PHP, size 80, by Ismael Miguel

priNt(a^Z^P^Q);$A^=$A^=$C+=$F.=($I^$I^$O<$PTTUWWXX______________aaabffjkory);;;;

There are many ways to get a short output like :.

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

Well, I had this source code: $__=NZrkPi^jAtFbW^TIOCfX;for($_=aa^WU;$_<AIa^pyQ;$_+=a^P)$___.=$_^T^X;$__($___);. Completely forgot to remove the priNt chars :/ This was a serious breach. I will have more careful next time. But nice one! – Ismael Miguel – 2014-11-09T07:27:56.423

1

QBasic, 43 bytes, by DLosc

DATA?
DIM P AS STRING
READ P
?P;P;CEEEEH36$

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

1

ECMAScript, 90 bytes, by Cris

(function(t){t.n=t;t.n(t.n.FFFbcdeehhiiiinooopprrrsstuuy)}) ((function(){alert(this+"")}))

The original solution is probably (based on Martin Büttner's work in the chat):

Function.prototype.F=function(){return this.bind(this)()};(function(){alert(this+"")}).F()

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

Lol, nice workaround! :) – Martin Ender – 2014-11-09T18:59:48.983

1

PHP, 33 bytes, by Ismael Miguel

echo  0X1^BXcdeilnu08DFHTTTgk467;

Tested on ideone.

This might actually also work on Windows. All it does is xor a hexadecimal 1 with an undefined constant which yields 0.

For the Windows one you can use

echo  7^'6cdeilnudBXX4';

which should also work on both platforms, because the string is simply coerced into an integer (being 6), and then we xor that with 7.

I'm curious what those were supposed to be.

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

Linux: PHP Parse error: syntax error, unexpected 'Xdeilnu0018DFHTTTgk' (T_STRING), expecting ',' or ';' in /home/gn2Uey/prog.php on line 2 but the windows is correct. But really nice try! – Ismael Miguel – 2014-11-09T22:24:17.450

@IsmaelMiguel sorry, the link is wrong, but if you use the code in my answer it works. I've fixed the link now. – Martin Ender – 2014-11-09T22:28:11.223

http://writecodeonline.com/php/ -> runs fine here. But yeah, you cracked it. My mistake was leaving the 1 in the code. The code I has is this: Linux: echo include H010D67XT^gTTFkXB48;. Windows: echo include '67X'^XB4; – Ismael Miguel – 2014-11-09T22:31:33.373

@IsmaelMiguel Wow, I must have been blind, I did not see that the lowercase letters spell include. – Martin Ender – 2014-11-09T22:37:59.593

And I didn't see I left that 1 behind. But it was really a nice catch! – Ismael Miguel – 2014-11-09T22:43:22.773

1

QBasic, 79 bytes, by DLosc

print"Iodine"
if f then scReen         BLaaabbefgghhhiiiiiiiikkllnnossstt,u-u.u

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

1

Python, 60, f.rodrigues

This post was so bad it had to be stopped.

print(60132)

4 or((odad95oamamarrdsn,nn.m7dtit.rminnrope8ed))

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

1

Bash, 47, Vi.

If you saw a $100 bill lying on the ground, wouldn't you pick it up?

Don't know much about bash, but I tested it and it works.

printf pp;o='${cel-sr(xe\     pp/pp/) fec1/; }'

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

Now try to find the original solution. Maybe I'll manage to change the task, so easy way whould stop working. – Vi. – 2014-11-12T14:51:16.980

1

DC, 28 bytes, by MichaelT

[ls+dn11ls1+dss<n]sn1ss0lnx

But I counted 27 bytes. Maybe there is a newline...

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

Off by one error in my counting. But yep. You got it. My original version was: 1ss[lsd1+ss+dn11ls<n]sn0lnx – None – 2014-11-13T23:20:19.953

One debate I had with myself when doing this was if I should reuse the same letter as operators for the registers, or if I should have used different registers (instead of s and n for registers, maybe c and q or the like) - any insight into the relative difficulty there? – None – 2014-11-13T23:44:21.080

@MichaelT It's obvious there are some registers in this program. I don't think it would be harder or easier just by changing their names. Those extra ss and ns are otherwise useless. It might be harder, if you made 1 a register and the number 1 is generated in other ways. – jimmy23013 – 2014-11-14T00:51:51.470

1

CJam, 51, by Optimizer

"JamesBdo,"YZ+/)BA*c+Y*Y%:BS@SB)))[JW:Z____)ci+*]U*

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

Nice, this was the original : YY+_B*J)_*@/_A+_)BZZ+*d]W%:c:BoY,U*S["James"SB)i))c – Optimizer – 2014-11-13T19:06:03.440

1

Python, 45, by muddyfish

print(eval((chr(32)+chr(45)).join(str(413))))

Interesting idea, I have to say. Wasn't hard to brute force though.

Sp3000

Posted 2014-11-04T19:45:25.013

Reputation: 58 729

1I ended up with print(chr(int(45+3.)))or((((acehjlrsv1234)))). I think yours looks a bit neater :-) – r3mainer – 2014-11-14T02:55:41.877

1

Brainfuck, 39, by Mig

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

FireFly

Posted 2014-11-04T19:45:25.013

Reputation: 7 107

Nice ! Original : +++++[>++++[>++++<-]<-]>>+++.----.++++. – Michael M. – 2014-11-14T10:19:24.113

Huh, and I thought I had matched your program perfectly. Neat how the characters used ended up exactly the same, then. – FireFly – 2014-11-14T11:49:47.607

Yeah I was pretty surprised too. – Michael M. – 2014-11-14T12:48:41.673

1

Python shell, size 15, xnor

1215954^1548696

Obtained by brute force in 1.42 seconds.

Code used to find solution:

#include <iostream>
#include <algorithm>

int main(){
    int digits[] = {1,1,1,2,4,4,5,5,5,6,6,8,9,9};
    int ndigits = sizeof(digits)/sizeof(digits[0]);

    do{
        int n1 = 0, n2 = 0;
        for(int i = 0; i < ndigits - 1; ++i){
            n1 = (n1 * 10) + digits[i];
            n2 = 0;
            for(int j = i+1; j < ndigits; ++j)
                n2 = (n2 * 10) + digits[j];
            if((n1 ^ n2) == 339018){
                std::cout << n1 << ' ' << n2 << std::endl;
                return 0;
            }
        }
    }while(std::next_permutation(&digits[0], &digits[ndigits]));
}

es1024

Posted 2014-11-04T19:45:25.013

Reputation: 8 953

Different from my original, but that's not surprising. How did you brute force it? Did you just count up? – xnor – 2014-11-15T07:05:34.067

@xnor I added the code I used to the answer – es1024 – 2014-11-15T07:05:59.823

I made a new bigger version. Happy cracking.

– xnor – 2014-11-15T10:27:22.353

1

Python shell, size 21, xnor

6446781078^9350512293

Obtained by brute force in ~27 minutes.

Code used:

#include <iostream>
#include <cinttypes>
#include <cmath>

inline bool check(int64_t a, int64_t b){
    int used[10] = {};
    do{
        auto r = std::div(a,10ll);
        ++used[r.rem];
        a = r.quot;
    }while(a);
    do{
        auto r = std::div(b,10ll);
        ++used[r.rem];
        b = r.quot;
    }while(b);
    if(used[0] > 2) return false;
    for(int i = 1; i < 10; ++i)
        if(used[i] != 2) 
            return false;
    return true;
}

int main(int argc, char **argv){
    int64_t i = 1ll << 32;
    while(!check(i,i ^ 15788895283ll)) ++i;
    std::cout << i << ' ' << (i^15788895283ll) << std::endl;
}

This checks every integer starting from 2^32 until it and its matching integer use up all the characters provided.

es1024

Posted 2014-11-04T19:45:25.013

Reputation: 8 953

1

C++, 244 bytes?, by Gabe Evans

#include<iostream>
int main(){int(CCDD)='%';char(a)[14]={'h','e','l','l','o',22+20/2,'w','o','r','l','d','!'};CCDD+=CCDD<=a[0];{{}};aa:adffillllllnnnnnnnnnnnnooooooooooooorrrrrrrrrssstttttttttttttttuuuuuuuuuuuuwwwwww:cout<<a;}

It was a bit of a struggle getting all those spare characters out of the way. You can see the code working here.

r3mainer

Posted 2014-11-04T19:45:25.013

Reputation: 19 135

1

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

1

C, size 62, by Olavi Mustanoja

#include<stdio.h>
#define _ +8
int*main(){printf("%d",1 _ _);}

es1024

Posted 2014-11-04T19:45:25.013

Reputation: 8 953

hah, nicely done! – Olavi Mustanoja – 2014-11-22T13:15:11.733

1

Python, 28, by user3863227

print(int(bin(1234)[2:])**2)

Factorizing the output gave this one away quite easily:

100220321420320200100 = 2² × 5² × 457² × 2190593²
sqrt(100220321420320200100) = 10011010010
int('10011010010',2) = 1234

r3mainer

Posted 2014-11-04T19:45:25.013

Reputation: 19 135

1

Perl - 26 bytes by primo

f:print po=>glob q$t{a,o}$

The q was easy to recognise. I took the potato letters away and shuffled the rest to discover glob suddenly. Then, I realised $$ will be used instead of {} and that => can be created. The last thing was f:, it took me a while to think of a label.

choroba

Posted 2014-11-04T19:45:25.013

Reputation: 161

You should have commented on my answer! I didn't see this til now. – primo – 2015-12-04T02:13:19.380

1

CJam, 14, by User23013

92e8.17 5e6.3%

I started by making some assumptions: that the exponent in each case was a floating point number, and that it had at least one digit after the dot (otherwise it's just the same as using an integer) and one or two before it (otherwise the result would be too small or too large). Then I used Python's itertools library to do some permutations. I got a result in under a minute.

Here's my cracking code:

from itertools import permutations
target = 108183.05975155532

def e(mantissa, exponent):
    return mantissa * 10 ** exponent

def ePartition(digits):
    """Generator function: gives every way to partition digits into an
    integer mantissa and a floating point exponent that is > 1 and < 100."""
    for eIndex in range(1, len(digits) - 1):
        for dotIndex in range(eIndex + 1, min(len(digits), eIndex + 3)):
            yield (digits[:eIndex],
                   digits[eIndex:dotIndex] + "." + digits[dotIndex:])


for p in permutations("12356789"):
    for spIndex in range(3,6):
        digList1 = "".join(p[:spIndex])
        digList2 = "".join(p[spIndex:])
        for mant1, expt1 in ePartition(digList1):
            for mant2, expt2 in ePartition(digList2):
                value = eval("e(%s,%s)%%e(%s,%s)" % (mant1,
                                                     expt1,
                                                     mant2,
                                                     expt2))
                if value == target:
                    print("%se%s %se%s%% -> %s" % (mant1,
                                                   expt1,
                                                   mant2,
                                                   expt2,
                                                   value))

DLosc

Posted 2014-11-04T19:45:25.013

Reputation: 21 213

1

JavaScript, 36, by MegaTom

x=alert;x(("x"+x)["substring"](6,9))

Tested in Chrome's console.

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

1

Python 2, 13, by mbomb007

71e0//36/0x92

The output is 0.00684931506849315 on my machine. But it worked on http://repl.it/.

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

It blows me away that there can be more than one solution! I'll post the original source tomorrow, since I can't remember it (I wrote it down). – mbomb007 – 2015-01-05T01:51:45.943

Actually, it's probably only because I used integer division. Nvm. – mbomb007 – 2015-01-05T01:52:23.767

I'm curious though, you did crack it with a program in Python, right? – mbomb007 – 2015-01-05T01:54:15.857

@mbomb007 No. It's easy to know the number is 1/146. Then just try to get a 1. There are other solutions like 1e3//760/0x92. – jimmy23013 – 2015-01-05T04:13:01.560

Original code: 6e1//073/0x92 – mbomb007 – 2015-01-05T14:35:40.700

1

Python, 39 bytes, Reticality

print("{0}{2}{1}{1}{1}".format(0,5,6,))

You could also swap the {0} & {2} and the 0 and 6.

Uri Granta

Posted 2014-11-04T19:45:25.013

Reputation: 2 675

1

JavaScript, 15, by Jamie Barker

Math.sin(1)+'O'

EZ PZ, as you said. ;)

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

1

Python, 13 bytes, by Reticality

To be run on an interactive Python console:

len("printi")

Outputs 6.

ProgramFOX

Posted 2014-11-04T19:45:25.013

Reputation: 8 017

1

CMD, 9, by unclemeat

set/a!!!0

There are too few possibilities here. The 4 alphabet characters are most likely command name, so I attack in that direction.

n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

Posted 2014-11-04T19:45:25.013

Reputation: 5 683

I was going for minimal byte count - here is a longer answer, but probably more difficult off the bat.

– unclemeat – 2015-01-13T05:51:30.340

0

Python, size 68, by horns

o=ord;print(chr(35),o('{'),o("-"),o("C"),o("Y"),sep="")#''''"02blpst

I think I've got the characters right. Either way, if I miscounted the number of quotes, the rest go after the comment (consulting the ASCII table helped).

Sp3000

Posted 2014-11-04T19:45:25.013

Reputation: 58 729

0

Bash, size 23, by The Wolf

q=echo;_(){ $q $q;};""_

I think the original solution (or red herring) should be:

q(){ q=;};q ""echo;$_ $_

which is invalid because it has one more space character.

jimmy23013

Posted 2014-11-04T19:45:25.013

Reputation: 34 042

0

C, size 63, es1024

main(_){int __=_;_<<=_;__=_<<_<<__;printf("%d",_<<__|__);_|__;}

What I'm trying to get is 2 << 16 | 16. Three leftover underscores, woohoo.                                    

feersum

Posted 2014-11-04T19:45:25.013

Reputation: 29 566

0

Rust, size 123, by Vi.

fn x(r:int)->int{for i in range(0,2){if i==r/r{{}}else if i==0{}}r%222*912}fn main(){print!("{}",x(993+2))}                

This shouldn't be the intended solution because of the no-op for loop, but it produces no warning in play-pen anyway.

(I'll leave the Clojure part for others.)

kennytm

Posted 2014-11-04T19:45:25.013

Reputation: 6 847

It may happen that the "hint" part whould be the hardest to crack... – Vi. – 2014-11-13T22:32:03.563

Welcome to version 2 of this task.

– Vi. – 2014-11-13T22:53:34.527

0

PHP, 62, aks.

for($i=1;$i<3.;)echo"$i. ".((($i++==2))?'Tues':'Mon').'day ';

Quite easy compared to other crazy PHP submissions.

n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

Posted 2014-11-04T19:45:25.013

Reputation: 5 683

0

JavaScript, 24 bytes (by fogcityben)

'.+';console.log( 'hi' )

Not sure what he really did with that . and +.

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

0

Python 3, 21 bytes, Reticality

print(str(...)[4::2])

Prints the p and final i from Ellipsis.

Martin Ender

Posted 2014-11-04T19:45:25.013

Reputation: 184 808

0

Python, size 26, by Oliver

print 2 * 3 * 37037,
print

The 2 prints threw me off a bit.

NinjaBearMonkey

Posted 2014-11-04T19:45:25.013

Reputation: 9 925

0

Python 2, Oliver

r =int= 2**2**2*2**2**2*2**2**2**2*2**2*2**2*2**2*2**2*2**2*2
print 16777216,

Demo on ideone

There is nothing tricky here. All the numbers are there, only need some rearrangement to comply with the syntax.

You can pipe the output to xxd to see that it has a trailing new line:

$ python -c 'r =int= 2**2**2*2**2**2*2**2**2**2*2**2*2**2*2**2*2**2*2**2*2;print 16777216,' | xxd
0000000: 3136 3737 3732 3136 0a                   16777216.

n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

Posted 2014-11-04T19:45:25.013

Reputation: 5 683

Thats wrong, the output had a trailing newline – Oliver Ni – 2015-01-12T04:21:25.827

The output was 16777216\n with the \n being a line break. – Oliver Ni – 2015-01-15T05:33:55.063

When you do print 'abc', the comma makes it not have a line break. – Oliver Ni – 2015-01-15T05:34:45.533

@Oliver: I always find a new line at the end. It will add space if you have another print statement, but I only have a single print statement here. I have also tested with executing the code from a file with the same result. – n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ – 2015-01-15T05:54:27.320

No. Take a look at this picture. http://oliverni.com/Screenshot%20(4).png

– Oliver Ni – 2015-01-17T02:52:21.863

@Oliver: Screen shot of the output from Python on Cygwin. http://i.stack.imgur.com/CHKXV.png There is the portable solution of placing the , at the end of the first line, but I don't know if the rule permit me to change my code, since you edited your post after I post my solution.

– n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ – 2015-01-17T04:23:50.170

0

CMD, 21, by unclemeat

set /a!!"echo>>tfile"

Repeating the set /a trick and ! operator is reducing the search space for otherwise a tough nut to crack.

I'm not too sure how set /a works, but when I evaluate set /a "tfile", it returns 0. Not sure if all strings evaluates to 0, but in this case, we end up evaluating (!!0) >> 0, which is 0.

n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

Posted 2014-11-04T19:45:25.013

Reputation: 5 683

I figured doing the same trick would be too obvious. However you were slightly off the mark to what I had in mind. I evaluate two separate strings with ! (negation), each producing 1 - then perform a logical shift >> on the two values - which produces 0. Nice one. – unclemeat – 2015-01-13T21:37:13.597

@unclemeat: I think you should explain your own version in your post. We typically don't change our answer to be the same as the original answer. Anyway, nice to know about the explanation. – n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ – 2015-01-14T02:35:33.837

0

Python, size 15, by mbomb007

There are at least 5 permutations that work. This is one of them:

`3*.7/50`[::~4]

It was pretty obvious that the original code was something of the form `«expression»`[«range»], so it wasn't difficult to place the backticks, colons and square brackets. On a hunch, I assumed that the range specifier was [::~i] for some value of i, leaving only 8 characters to permute. This took only a fraction of a second. Here's the code I used:

from itertools import permutations

perms = [''.join(p) for p in permutations('03457*./')]
for p in perms:
    try:
        e = '`'+p[:-1]+'`[::~'+p[-1:]+']'
        if eval(e)=='6991':
            print e
    except:
        continue

(The original code is actually a bit flakey, since the result of 3*.7/50 isn't guaranteed to be 0.041999999999999996 all of the time.)

r3mainer

Posted 2014-11-04T19:45:25.013

Reputation: 19 135

Yep. For some reason, it wouldn't let me use *2 after the code enclosed in backticks... I couldn't find anything about why not. It works fine if it's after a literal string, or str(expr)... – mbomb007 – 2015-01-13T17:31:47.963

0

Python, size 30, by mbomb007

Didn't need much unscrambling:

' rsin[~(ddf) 0]rot13'[9+6: :]

r3mainer

Posted 2014-11-04T19:45:25.013

Reputation: 19 135

:O #Mindblown... That's not even close to the original concept... – mbomb007 – 2015-01-13T17:35:17.250

I'm going to remove a character to make it harder. – mbomb007 – 2015-01-13T17:36:04.217

Wait, I found a way to remove your workaround! I'll post the new one! – mbomb007 – 2015-01-13T18:02:52.623

http://codegolf.stackexchange.com/a/44514/34718 – mbomb007 – 2015-01-13T18:08:38.027

I posted the solution. – mbomb007 – 2015-01-20T20:08:27.387

0

Python 2, Oliver

rt =in= 2**2**2*2**2**2*2**2**2**2*2**2*2**2*2**2*2**2*2**2*2,
print 16777216

All actual credit to n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ with this solution. I just stole it and corrected it.

user34736

Posted 2014-11-04T19:45:25.013

Reputation: