Put the ‘Fun’ Back in Befunge

Disclaimer: may or may not be interesting to non-programmer types.

I’ve always been fascinated by esoteric programming languages, though I didn’t until recently know what to call them. The poster child of the esoteric languages is Brainfuck, a programming language whose programs consist entirely of the following eight characters: <> + – [ ] . ,

Any characters other than these eight are ignored by the interpreter (including whitespace). Here is an example brainfuck program:

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

It simply outputs “Hello World!” to the screen.

But one-dimensional code is so passé. All the real coders are using two-dimensional languages, for example PATH. PATH programs look somewhat like pictures, and if you look at them you can trace the path of the program visually around it, in two dimensions. I did a little experimentation in PATH but then settled on Befunge as my esoteric language of choice because it allows for user interaction (which PATH does not).

Here is an example Befunge program:

vv  <      <
    2
    ^  v<
 v1<?>3v4
    ^   ^
>  >?>  ?>5^
    v   v
 v9<?>7v6
    v  v<
    8
 .  >  >   ^
^<

It generates random numbers.

Unfortunately, there was no interpreter for Befunge written in PHP (that I could find) so I wrote one. It’s called Bephunge and it’s awesome.

I am currently working on a Befunge program that allows two humans to play Tic-Tac-Toe. This could probably be done in about 5 minutes in any typical programming language, but then it wouldn’t blow my mind.

One Response to “Put the ‘Fun’ Back in Befunge”

  1. Pedro Gimeno says:

    The Bephunge link is no longer working and it’s not in The Internet Archive either. Could you please upload it somewhere else (or email it to me)?

Leave a Reply