Esoteric Programming: Oh, You Think You’re So Smart? Try THESE

Ready for the big boys?  They’re ready for you!  Check out these Beasts of the Esoteric Language community — languages that require herculean effort just to make a working program.

Whenever

Yet another written by David Morgan-Mar, whose baby I will have some day.  The commands and syntax in Whenever are actually pretty normal (they look like standard C) — it’s in the rules of execution that the esoterica comes out. The commands in a Whenever program will get executed, eventually. They might not get done in the order you wrote them. In fact, they almost certainly won’t — Whenever programs are treated like to-do lists, and commands are taken at random from any line in the program. So you can’t just assume it’ll march through your commands in the order you asked.

Hello world in Whenever:

1 print("Hello world!");

Pretty straightforward, but then again showing you “Hello world!” for Whenever doesn’t really convey the specialness of this language. As David Morgan-Mar says, “This is actually embarrassingly trivial in Whenever. Sort of a shame when you see it done in languages like Befunge and Malbolge.”

The challenge here is of course the fact that you have to write your algorithm so it doesn’t depend on sequential order.  That might be tricky, given how fundamental that assumption is to pretty much any algorithm ever written.  Fortunately Morgan-Mar makes it a little easier on us by allowing a command to be deferred until later, if other steps that it requires haven’t been done yet.  While this may sound like a disappointing concession to normalcy, programming in Whenever would probably be impossible without it.  Or is it?  I wonder if some genius with time on their hands could devise a Whenever implementation of some real algorithm — not just “Hello World”, but something with some meat on its bones.  Could we do an FFT in random order?  Who wants to find out?

Entropy

Why must you programmers all be so precise? So hung up about “repeatability”, and “accuracy”, and “operates as intended”. Why can’t you be at peace with the natural order of the universe? Try to be more like Daniel Temkin‘s language Entropy, where disorder and decay is the name of the game.
Quote from Daniel Temkin’s Entropy page:

“Entropy is a programming language about giving up control. All data decays as the program runs: each value alters slightly every time it’s used, becoming less precise. An Entropy programmer needs to abandon the pursuit of precision which most programming demands — often working against years of habit — in order to program effectively. Any output from an Entropy program will be approximate, and the more the data is accessed, the more random it will become. The programmer has, at best, a short window to get his/her idea across before the program corrodes. The program itself is not altered — so the next time it runs, it is restored to its original condition, only to decay again through its next run.”

Wait, have I been programming in Entropy my whole life?

To watch Entropy in action, try interacting with Drunk Eliza — Temkin’s implementation of the famous chatbot Eliza (a simple chat program which fooled several users with its deceptively attentive responses) in his Entropy language.  You can interact with Drunk Eliza just as the original users did with Eliza back in the 60’s, but you get the hilarious experience of Eliza gradually losing the ability to communicate.

Befunge

This one is weird for a whole mess o’ reasons:

  • Every command is made by just one character — why be inefficient and use a whole 5-letter word like “print”, when you could just use “&”?
  • You’re only allowed so much space to write your program — in fact your program can’t have lines more than 80 characters long, and you can’t have more than 25 lines. That’s pretty small. No wonder you need to be efficient.
  • Feeling constrained by the size limits for your Befunge program? Well, here’s some relief — if you want, go ahead and let your commands “wrap around” — if you hit the right edge, keep on going starting back at the leftmost edge.
  • Feeling confused by that last rule? How the hell would “wrapping around” work? Well, stop thinking about a Befunge program as a linear series of commands that get executed. Instead, picture it like Pac Man — after your program gets done executing whatever command is encoded by the current character it’s reading, it’s allowed to move in any direction — not just to the right, but up, down and left. In that sense your program is a 2D grid around which the compiler wanders, consuming instructions. Hence the wraparound rule — if your compiler hits one of the edges and is told to keep going, it just jumps back to the opposite edge. (And so your Befunge program is topologically equivalent to a torus.)
  • Mind blown yet? There’s more — your programs are allowed to modify themselves. So some of the commands can tell your compiler to modify the source code by changing characters around.
  • The point of Befunge? It is a glorious reason — it’s to make compiling as hard as possible. It’s hard enough on humans to understand the code when the instructions are free to be ordered in any direction whatsoever — now imagine being a compiler and having to make sense of it. But probably even worse from the compiler’s point of view is the self-modifying code. That means the source code might change, depending on stuff that happens later on.

Hello World in Befunge:

"dlroW olleH">:v
^,_@

Doesn’t look that weird, eh? Check out “99 bottles of beer

v v0\1:\1:{CODE}{CODE}\!:p15-<          Bottles of Beer for Befunge
0 \ {befunge} >" ekaT">v                written by Brian Raiter, 5/97
0>>.0"llaw eht no "v<#,:                breadbox@muppetlabs.com
"\, >"eno"^>0 #"^1^_v
c1,>51g#^_"ti"^. >vr : $
"::^" down, pass "<e 5
>^|\*25,<^ # i e ^g1<
,>052*":dnuor t"vbv:<
v0_^ . , ^< " "
>52*".ll"v >,^ fb e
v<v<v_$!|>"aw eht no r"v
""" ,: >" ;"^ f ^<@
meo >^"bottle"< "o $
o m^"re:"<v _^#g15< v_^
s"" >52*^>"s"^v"les"<,:
"^< ^"99 bott"< >^>^<
>" yub ,erots eht ot oG"^

Half-Broken Car in Heavy Traffic

Another member of the 2D-grid family of programming languages, along with Befunge (above) — it’s not quite as weird as Befunge, but I include it for the charming model for the programming flow.  In HBCHT, your program interpreter is a car, stuck in heavy traffic (as you’d guess), interpreting various road signs to figure out where to go next.  You wander around a “city” (your source code), following the signs, along the way producing the result that the programmer intended.  And what makes it “half-broken”?  To keep things from going bonkers, your car can’t turn left.  Sounds like a Hooptie to me.

Hello World in Half-Broken Car In Heavy Traffic:

     v                           >v       ^
> v  <                            v     >>^<
  v  ^  v                         v     ^
     ^  <                         v     ^
        ^                         v     ^
  >   />^<v                       v     ^
  ^  >v<  <                       v     ^
          ^                       v     ^
  ^   > />^<v                     v     ^   #
  ^   ^>v<  <                     v     ^   ^
  ^         ^                     v     ^   ^
  ^     > />^<v                   v     ^   ^
  ^     ^>v<  <                   v     ^   ^
  ^           ^                   v     ^   ^
  ^       > />^<v                 v     ^   ^
  ^       ^>v<  <                 v     ^   ^
  ^             ^                 v     ^   ^
  ^         > />^<v               v     ^   ^
  ^         ^>v<  <           >v  v     ^ >>^<
  ^               ^           ^v  v     ^ ^
  ^           > />^<v         ^v  v     ^ ^

             *** middle section cut out because man is this one long *** 
^ ^         >>^^<              v  v ^     ^
^ ^         ^                  v  v ^     ^
^ ^                            v  >>^<    ^
^ ^                            v  ^       ^
^ ^                            v          ^
^ ^                            v          ^
^ ^    v                       v          ^
^ ^    <                       v          ^
^     >^<                      v          ^
^     ^                        v          ^
^     v                        > ^<       ^
^     <                        ^
    >>^<
 >  ^<v
 ^ >v<<
  v
>v<
  ^
 >^<
 o>v
 v >  ^<
 v ^

I admit, I chopped out a whole middle section of this one — I figured you get the idea from the 7,000 lines that I did include.  It’s a little more regular-looking than Befunge, but still pretty ridiculous for simply printing out “Hello World”.

Malbolge

Malboge is the Big Bad Daddy of all esoteric programming languages.  It’s sole reason for existence is to be difficult to program in — no abstract minimalism, no cutesy-pie primate languages, just straight up OBFUSCATION.  Here’s how Wikipedia describes it:  “Weaknesses in the design have been found that make it possible (though still very difficult) to write useful Malbolge programs“.   It’s so frustrating to program in that the first working Malboge program was presented to the world a few years after the invention of the language — and the composer of this Malboge program, Andrew Cooke, didn’t simply sit down and write out the program.  He had to use a computer search algorithm to gradually build a valid program through trial and error.  Since then a handful of other Malboge programs have been painstakingly created, but this is certainly not a language you pick up a certificate in at the local community college.

Hello World in Malbolge

('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}=<M:9wv6WsU2T|nm-,jcL(I&%$#"
`CB]V?Tx<uVtT`Rpo3NlF.Jh++FdbCBA@?]!~|4XzyTT43Qsqq(Lnmkj"Fhg${z@>

Got that? If I coded that up and wound up missing a semicolon, I think I’d just snap my laptop in half and burn down my house.

The actual rules for how a Malbolge program is interpreted are as ridiculous as you’d expect.  I won’t even bother to give a complete description, but here’s a flavor of what to expect:

  • There are only eight possible Malbolge commands.  Seems like a reasonable number.  But the rules for interpreting the commands are a little tricky — input characters are converted to base-3 (ternary), adding the resulting number to itself, then taking the remainder after dividing by 94.  The result is a then checked to see if it’s one of the eight allowed commands.
  • Some commands are straightforward, such as printing a value to the screen.  Others are a little odder — a value of “39” (in ternary) means “rotate the ternary digit in memory by one digit”.  Another command tells the interpreter to jump to a different part of the program — the good ol’ GOTO command.
  • After a command is executed, it’s replaced in the source code by an encrypted version of itself.  Because why would you want to reuse a piece of useful code, later on in the program?

If you want to know more, Lou Scheffer keeps a copy of the original language specification by the inventor Ben Olmstead.  But if you’re up for the challenge, try writing some programs in it — something a little harder, say, 99 Bottles of Beer On The Wall.  Let’s look at a snippet of code from Hisashi Iizawa’s program that prints out the lyrics to “99 Bottles”, a program that he produced only seven years after the invention of the Malbolge language:

99 Bottles of Beer, in Malbolge:

b'`;$9!=IlXFiVwwvtPO0)pon%IHGFDV|dd@Q=+^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A*)(&&$@?!=6}4{yywwuus10/o'n%lj('&f|ezcaa__]][wvuWmVkTRnQlkNLLaJIHFbE`_
B]@U>Y<;P9775533H1/KJ,HA*?(&&$$">=<|4{2ywwu321q)p'nl*k('gg${"c~a`^z]xwvYtmrUpSRPlOMMbK`IGGEE
Z_^]?U>S<::8866442200.JIH*@)>C&A@?"=<5|{8y65vtt10/(-n+lk"'&%e{dyb``^^\\ZvutVlUjSQmlkMcLaJHHF
bECCX]\[=S<Q:886R5PON1LKJCH+F)(=BA@"8!6}{{2y0543s+r)pnnlljjhhffddbb`|_zyx[vutslUTSQQOOMihgI_
H]FDDBB@@>><XWV8N7L5331MLK-C,A*(D'BA$""=<;:927xwvt2s0/p-n+*)('~%f#dcaa__]y\ZZotsrTjShQOkjiKa
J_HFFDDBB@@>><X;99NS6QPO2MLKJIHA*E('%%:#8=~;:9z7654321*/p-,m*k(hh}$#dyb}`{zy[qZoXVVTTRnmlNdM
bKIIGGEECCAA?[>YXWP9T76K42200.JI+G@)>'%A@?!7~5|zzx654t,s*qo-n+*jj!h%fec!b}|{^s\[vYWWlqTonQlO
jchKfIHFFDDB^]\>T=R;P9NS6QPO2MLE.-,*FED&<%:#!!}}{{yyw543s+r)pnnl*kii~%f#"caa|{zsx[ZutVrkTinQ
lkNiLgfe^cFEDYBW\[=YR;P977553O200EJIH*@)>C&$$9>!<;|9z7654-tsrppnnll#('&f|ezca}|{]s\qZXtsrTjS
hQOOMihgI_H]FDDB^A\[><<WVUTSLQ43NM/KD-BG*ED'B%@?>=<5:{zy0wuussqqoomm$ki'hff{"c~}`{t]\wvuWmVk
pSnmPNNcLKfIGG\aD_^A\?T=<;99775QPO1G0E.,HG)E>'<%#?"~~5:98x0w.ussq/pnn%*k('hff#z!ba|{z\r[puXs
rUpSnglONihgI_H]FDDYBW\[Z<R;P977553311//--++))'CBA#9"7<}:9z7x54-t1rq(ommkkiiggeecca}|{]s\qZX
tsrTjShQOkjiKaJ_HFFDDB^A\[==XWVOT7R542N1LKJ-HGF?D'B%$""7~5|zzxxv43s1*q(ommk)jhh}$e"!~a|{zyr[
vYXVVTTRRPPNNLLJJHH]FD`_A]V?TY<WVU8SRQPOHM0K.-++))''%%#?"~~5:9y70w.us1r/.-n+*)('~%fedbbw`u^\
xwvXnWlUSSQQOOMMKKIIGGEa`_AW@UZ=XW:U8SRQPONG0/.C,*FED&<%:#!!}}{{yywwuussqqo-n+*k(!h%f#"!aw`u
^\\ZZoXVrqpRhQfOMMKgfeG]F[DBB@\[Z<R;P97S6QP22GL/J-,*F)DCB%:?"!~||zz1x/432r*q(ommkkiiggeeccaa
_{^yx[vYtmVqTSQQOOMMKKIeHFF[`_A]V?T=;;9977553O2MLK.IHAF)('%%##!=~||3876v.u,sq/pnn%*)(h~g|ecc

 

© 2011 TimeBlimp Thith ith a pithy statement. Suffusion theme by Sayontan Sinha