While going through entries for OMGWTF2, one question often crept in our discussions “What would it be like to have to maintain this code?”

Some entries tried to enter our nightmares based on their otherworldly variable and function names, others revealed themselves as colossal-sized horrors with regards to the sheer size of the code base. However, one entry stood out among all the others - Oxin’s entry written in HTML and "Diarescript".

The source is surprisingly compact - the performance - not all that bad. Strange for a so-called "beast", but that’s about as far as the compliments go.

For starters, most programming languages will at the very least attempt to follow some written language. Something that a programmer can relate to internally. But not Diarescript. I mean, just look at it - the syntax flows like the transcript of a drunken hillbilly's rumblings during a fever dream:

<script type="text/diarescript" class="function" name="randinc">
	VALUE PLUS RANDBIT SEED
	VALUE BE THAT
</script>
<script type="text/diarescript" class="function" name="randint">
	VALUE BE 1
	RANGE PARAMETER MINUS 1
	NUMBERS BE THAT
	PROCESSOR BE RANDINC
	PROCESS NUMBERS
	SEED BE VALUE
	PROCESSOR BE RANDINT
	RESULT VALUE
</script>
<script type="text/diarescript" class="function" name="randomizer">
	PROCESSOR BE RANDINT
	PROCESS 8
	TEMP BE THAT TIMES 32 MINUS 1
	SEED BE TEMP
	PROCESSOR BE RANDOMIZER
	RESULT TEMP
</script>
<script type="text/diarescript" class="function" name="genyesno">
	VALUE BE 0
	CALL RANDINC
	VALUE
	LOG VALUE
	VALUE
	IFZERO DISPLAY YES!!
	VALUE BE VALUE MINUS 1
	LOG VALUE
	VALUE
	IFZERO DISPLAY NO!!
</script>
<script type="text/diarescript" class="function" name="randombox" width="100" height="40">
	DRAW
	IMG BE THAT
	PROCESSOR BE RANDOMIZER
	PROCESS IMG.DATA
	IMG.DATA BE THAT
	DRAW IMG
	PROCESSOR BE RANDOMBOX
	WAITDELAY BE 0
	WAIT RANDOMBOX
</script>
<script type="text/diarescript" class="function" name="start">
	LOGGING BE ON
	BUTTON GENYESNO
	SEED BE 0
	CALL RANDOMBOX
</script>

But then you look under the hood...your high-falootin’ math operator symbols? Forget about them! They’re keywords now.

case 'be':
	genLineStart += '=';
	break;
case 'plus':
	genLineStart += '+';
	break;
case 'and':
	genLineStart += '&&';
	break;
case 'minus':
	genLineStart += '-';
	break;
case 'times':
	genLineStart += '*';
	break;
case 'dividedby':
	genLineStart += '/';
	break;

And what about randomness? Two scoops is required because you just can’t trust just one call with the same seed.

case 'randbit':
	genLineStart += '(function(seed){ return ((Math.sqrt(Math.random(seed)*Math.random(seed))< 0.5) ? 1 : 0)})(';//Math.Random doesn't generate random enough numbers in a single call
	genLineEnd = ')' + genLineEnd;
	break;

If I were make my living writing script in Diarescript, I can almost guarantee that my brain would have to become stupider to compensate.

And as to dreaming in code after a long day “hacking” an app written in Diarescript? Well...let’s just not go there...but...if you're curious, give it a read through yourself (download here) and if you're a little insane, post some code in the comments and let the world judge who truly is the best Diarescripter in the land.

Congratulations on winning the Beast of Burden Award for the worst code to maintain.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!