$"x=5;$%=$_%5&4?$@=~s&$&chr$%&e&$@=~s&.{5}&0>print$"^=$\&&e&0:$%*4+$_% +5^3 for+map{.2*ord,ord,.04*ord}split??,"\$;>Hs>w\6/6galqUadRFH6e-EEun?\@j\ +rY"

This is essentially an optimization of last year's Since JAPH seems to be popping out all over. Hopefully it's still just as even more inscrutable.

This almost hit all of my optimization targets:

  1. no parens
  2. no whitespace (other than \n)
  3. use warnings; and use strict; clean
  4. a single statement, aka one-liner. Because of initialization, it's actually two statements
  5. use statement-modifier foreach (needed in order to satisfy some of the above conditions)
  6. 2 equal length lines (<80 chars)

I really wanted to have the line break between the for and the map, since unlike punctuation, those can't be run together. However I was not quite able to convince the program to collapse into anything smaller. Making the top and bottom lines equal length at least is pretty trivial as there's always a spot here or there to throw in an extra character.

Replies are listed 'Best First'.
Re: Everything old is new again
by truedfx (Monk) on Jan 17, 2006 at 01:38 UTC

    Very ugly :)

    I really wanted to have the line break between the for and the map, since unlike punctuation, those can't be run together. However I was not quite able to convince the program to collapse into anything smaller.

    You can shave three characters off of the first line: one by noting that 0>print(...) can be shortened to !print(...) (let's assume you can print things), and two by noting that $x=~s/$/.../ always evaluates to 1, so ($x=~s/$/.../)&...&0 can be written as ($x!~s/$/.../)&... instead. This makes the first line:

    $"x=5;$%=$_%5&4?$@!~s&$&chr$%&e&$@=~s&.{5}&!print$"^=$\&&e:$%*4+$_%5^3

    And after shaving off three characters, you can put for on the first line, add some filling to the second line, and have the break where you wanted it without increasing the code size.

    HTH