Intercal

There are programming languages where it possible to write almost incomprehensible programs. Have a look at the Obfusticated Chess program for an excellent example in C.

Intercal is the only language specifically designed to make things as incomprehensible and ludicrous as possible. Consider, for example, the following manual entry:

Caution! Under no circumstances confuse the mesh with the interleave operator, except under confusing circumstances!

Also of great interest is the 'PLEASE' operator. If this is not used enough, the compiler will complain and refuse to compile the code. Use it too much, of course, and the compiler with think you are grovelling and refuse to compile. Moderation is all.

The Wikipedia entry is a good place to get a flavour of the language.

In much the same way that "Hello World" provided a good idea of how Ook! worked, it provides an even better idea of C-INTERCAL (one of several Intercal flavours). Here it is:

DO ,1 <- #13
PLEASE ,1SUB#1 <- #238
DO ,1SUB#2 <- #108
DO ,1SUB#3 <- #112
DO ,1SUB#4 <- #0
DO ,1SUB#5 <- #64
PLEASE ,1SUB#6 <- #194
PLEASE ,1SUB#7 <- #48
DO ,1SUB#8 <- #22
DO ,1SUB#9 <- #248
DO ,1SUB#10 <- #168
DO ,1SUB#11 <- #24
DO ,1SUB#12 <- #16
DO ,1SUB#13 <- #214
DO READ OUT ,1
PLEASE GIVE UP
	

I had some trouble working this out. For the equally cerebrally-challenged you need go no further than Clinton Forbes' Intercal Blog. Nevertheless, parts of this program are fairly simple. Thus the first line:

DOexecute the following statement
,1create an array of 16-bit integers (,) in the first position (1) of the 16-bit integer array stack (each data type has its own stack)
<- #13set the array to be thirteen elements long (the number of characters in "Hello World")

Un morceau de gâteau,ne c'est pas?

After this it gets a bit trickier

PLEASEbe nice to the compiler (functionally equivalent to DO but politer)
,1our array, as above
SUB#1update the first element of the array...
<- #238to be 238 (decimal)

So it's pretty clear what the line does but it raises the question

"What the hell does 238 have to do with anything?".

It certainly isn't ASCII for 'H' which is what we might expect.

Well, this is where the language transcends normal obfustication and reaches into the realms of pure evil. It works like this:

Imagine a piece of tape with the ends joined together. Each ASCII character is written in binary on the outside of the tape. A notional 'HEAD' reads the ASCII value at its current location. The Head starts at position/ASCII zero and you change the value by moving the head a certain number of steps.

This being Intercal, there are a couple of things which make it trickier. The Head only moves backwards rather than forwards but this merely changes addition to subtraction. The real trick is that the Head is on the inside of the 'tape' which means it sees the binary characters back to front.

I turn again to Mr Forbes' invaluable guide.

Head positionRequired outputRequired binaryReverse binaryRequired head positionMove head by
0H0100 10000001 001018238
18e0110 01011010 0110166108
166l0110 11000011 011054112
54l0110 11000011 0110540

and so forth

Sure the inventors (Jim Woods and James M. Lyon) appear to have rather too much time on their hands but at least they are wasting it creatively and in a totally ludicrous manner. I like that in a person.

date

last updated
time