Befunge is a two-dimensional esoteric programming language invented in 1993 by Chris Pressey with the goal of being as difficult to compile as possible. Code is laid out on a two-dimensional grid of instructions, and execution can proceed in any direction of that grid.
A Befunge program is laid out on a two-dimensional playfield of fixed size. The playfield is a rectangular grid of ASCII characters, each generally representing an instruction. The playfield is initially loaded with the program.
Execution proceeds by the means of a program counter (-93) or instruction pointer (-98). This points to a grid cell on the playfield. The instruction pointer has inertia: it can travel to any of the four cardinal directions, and keep traveling that way until an instruction changes the direction. The instruction pointer begins at a set location (the upper-left corner of the playfield) and is initially travelling in a set direction (right). As it encounters instructions, they are executed. Befunge-93 has no jumps farther than two cells, so control flow is done by altering the direction of the program counter, sending it to different literal code paths. (Befunge-98 has far jumps, but because of inertia in the community, these are rarely used.) Befunge programs mostly store data on a stack in the manner of Forth, but they can also read and write the contents of any cell in the playfield, given its coordinates, thus Befunge code can be self-modifying.
Befunge is believed to be the first two-dimensional, ASCII-based, general-purpose (in the sense of "you could plausibly write Hunt the Wumpus in it") programming language. Its form was influenced in part by the multimedia scripting application AmigaVision, and in part by Forth.
The original Befunge (known as "Befunge-93" to distinguish it from others) has spawned many descendants and remote cousins. The closest relative, and most direct extension, of Befunge-93 is Befunge-98 of the Funge-98 family of languages. Each Funge extends the central concepts of Befunge to a given number of dimensions (for example, Unefunge is one-dimensional, Trefunge is three-dimensional, Nefunge is n-dimensional, etc.). Today, Befunge powers fungot, an IRC bot that enjoys some popularity in the esoteric programming community. Its source code is so small that it fits on a T-shirt.
The word "Befunge" started life as a typographical error for the word "before", typed by Curtis Coleman at 4AM on a BBS chat system. It was then reverse-endowed