View Source Document


Befunge-93 Example Programs

Entries which have a CC0 in the License column are in the public domain, under the Creative Commons CC0 Public Domain Dedication. All others are freely redistributable in this archive, but remain copyrighted by their original authors. See the file LICENSE for more information.

Name License Author Date Notes Kalyna Zazelenchuk 1/1/93 This program will input a string of sixteen characters or less, and (p)ut those characters in order on line 3 (the line with the *'s). It will then randomly find numbers from 1 to 16, (g)et the characters at line 3 in random order, replace them with *'s, and print them out. Effectively produces anagrams of words you type in. It uses the code from '' to generate random numbers. CC0 Andrew Turley 1/1/2999 aturley's .sig; cellular automata gasket generator. Kevin Vigor 4/9/97 A simple program that prints the "beer song" (99 bottles of beer on the wall...) from 99 down to 0. Part of the Beer Song archive. Chris Lahey 6/8/97 A squashed (22x10) beer singing program, gramatically correct. Keith Arner 4/10/97 Another "99 Bottles of Beer" program. Chris Lahey 4/11/97 Another singing algorithm. Denis Moskowitz 4/11/97 Yet another singing algorithm. David Johnston 4/11/97 Another singing program. Chris Lahey 4/11/97 A crammed (14x21) singing program. CC0 Wim Rijnders 5/2/97 A beer bottling program. CC0 Wim Rijnders 5/12/97 Again with the bottles. David Johnston 5/13/97 Crammed (22x9) singing beer program which doesn't use good grammar or punctuation. CC0 Wim Rijnders 5/12/97 A small subset Befunge-93 interpreter written in Befunge-93. Barely smart enough to execute the helloworld program within the #-delimited block. Runs like a cow. CC0 Wim Rijnders ?/?/00 A version of with some bugs (pointed out by Amir Karger) fixed. Denis Moskowitz 7/17/97 Befunge logo source. Sam Holden 7/17/97 Befunge logo source. Ben Olmstead 7/18/97 Befunge logo source. Kevin Vigor 8/13/97 Befunge logo source. Kevin Vigor 7/18/97 Non-standard (oversize) Befunge logo source. Bryan L 4/10/97 This is a befunged calculator. Meaning ".", the print command, will also pop the result off the stack. Fortunately, the duplication command ":" is supported. This calculator will blithely ignore anything that isn't a number or a supported command. The list of commands is found on line 3. CC0 Chris Pressey 7/20/97 Like, but continues to replicate itself. Kalyna Zazelenchuk 1/1/93 Generates a printable ASCII table, with characters and corresponding codes in decimal, from 34 to 127. CC0 Wim Rijnders 6/5/97 Program which reproduces itself in Befunge-space. Keymaker 9/3/08 Computes the digital root (see of the input. CC0 Dmitry M Litvinov 12/1/96 A minimalist adventure game. n - go north s - go south e - go east w - go west d - dress l - labour CC0 Chris Pressey 1/1/93 "Like Eliza, except better :-)" CC0 Chris Pressey 1/1/93 Makes 'enigmatic aphorisms.' A loose interpretation of a program in '1001 things to do with your Commodore 64.' This is an example of how to simulate a 'gosub' with a value. CC0 Chris Pressey 1/1/93 Same as '', but uses self-modifying code. Greg Wright 6/5/97 Euclidean algorithm. CC0 Chris Pressey 1/1/93 Asks for a number, and supplies the factorial of that number. Jason Reed 5/18/97 Factorial generator, (3x12) Chris Lahey 6/8/97 (23x1) factorial generator. CC0 Chris Pressey 1/1/93 The ubiquitous "Hello, World!" program. CC0 Chris Pressey 1/1/93 Translates ASCII input into hex output. CC0 Chris Pressey 1/1/93 Prints out "Hello, World!' forwards, then backwards, then forwards, etc. Demonstrates how one can so easily change the direction of the PC to support their own wicked desires. Keymaker 9/3/08 The first of a series of really fine quines (self-printing programs) by Keymaker. Keymaker 9/3/08 The second of a series of really fine quines by Keymaker. Keymaker 9/3/08 The third of a series of really fine quines by Keymaker. CC0 Dmitry M Litvinov 6/1/97 An implementation of John Conway's game of Life. Greg Wright 6/5/97 3x3-Matrix Addition Chris Lahey 4/11/97 A Mandelbrot fractal generator. CC0 Chris Pressey 1/1/93 A conversion of a Commodore-64 graphical pastime: a dead-simple random maze generator. CC0 Dmitry M Litvinov 2/1/96 "First, example easy writed stupid prog." Befunge bypasses cultural and lingual backgrounds. Try this "easily written" program and see what it does. CC0 Chris Pressey 1/1/93 Produces single-digit numerological equivalents of words you type in. (Users should be warned that the significance of the output of this program is of extremely questionable practical value. But it is consistant.) (This algorithm is also known as the "digital root".) Aaron Dale 3/20/97 A program to implement the "pairing function" (<x1,x2> = (2^(x1) * (2*(x2) + 1)) - 1), which maps any two natural numbers onto the set of natural numbers, without repetition. CC0 Chris Pressey 8/25/12 Checks if the first line of input is a pangram -- a sentence which contains all the letters of the alphabet, such as "The quick brown fox jumps over the lazy dog" or "Pack my lunch box with five dozen liquor jugs." Case-insensitive, and ignores most punctuation, but "high" punctuation (above ASCII character 90) will likely confuse it. CC0 Chris Pressey 7/12/97 Generates a gasket (Serpinsky triangle) using Pascal's Triangle. Ben Olmstead 6/25/97 Produces the first hundred digits of pi in under one hundred characters of Befunge, but cheats in that it simply decompresses the digits encoded in the source code. Kevin Vigor 7/2/97 Generates the first hundred digits of Pi. It does this not by cheating, but actually calculating Pi; unfortunately it far exceeds 100 characters of Befunge code. Kalyna Zazelenchuk 1/1/93 Lists the counting numbers incrementally from one and checks if each is prime. Chris Pressey 1/1/93 Generates random numbers between 1 and 9 as statistically evenly distributed as the computer's random number generator. Ken Bateman 4/12/97 A 3x10 random number generator. Ken Bateman 4/12/97 A 5x7 flexible random number generator. The number of bits is set with the 88+ at the top left. As shown this program will generate a random number from 0 to 32767. Ben Olmstead 4/24/97 A 2x13, 0..255 random number generator. Ben Olmstead 4/24/97 A 2x12, infinitely looping 0..31 random number generator. Greg Wright 5/18/97 4x7 random number generator. Artyom Baranov 4/5/96 THE smallest Befunge RNG-16. (16x1) Kalyna Zazelenchuk 1/1/93 This program, crammed into a 14x14 block, makes random numbers from 1 to 16 using multiple "?" statements. Chris Pressey 1/1/93 12x9 random number generator, like and Matthew D Moss 2/1/96 A 7x7 random number generator in the tradition of .., but using mathematics to reduce the problem before writing the code CC0 Dmitry M Litvinov 2/1/96 A 4x10 random number generator which produces the same output as .. Unlike most Befunge sources this one has a symmetrical beauty to it. Artyom Baranov? 12/1/96 An 8x4 random number generator a la ??? 12/1/96 A 13x3 random number generator a la and Chris Howe 4/9/97 A 4x9 flexible random number generator; if you change the 4 in position (1,2) to another integer n it will generate a number between 1 and 2^n (inclusive) for 0<n<9. Chris Lahey 4/11/97 A 3x7 random number generator. CC0 Dmitry M Litvinov 2/1/96 A command-line calculator with postfix notation. Kimberley Burchette 12/1/96 A version of crammed into a 23x12 block. CC0 Chris Pressey 1/1/93 You control an 'O' going through a maze of '*''s. You can type in 'n', 's', 'e', or 'w', and the 'O' travels in that map direction. This not-particularly-challenging game ends when you hit a '*'. ??? 9/11/97 Performs the rot13 algorithm. CC0 Chris Pressey 12/1/96 A self-reproducing 80x1 program. This program can also be used to test for the @ vs StringMode bug. Kevin Vigor 5/28/97 A 14-byte Quine (self-reproducing program.) David Johnston 5/7/97 Crammed (14x6) self-listing program. Denis Moskowitz 5/8/97 14-byte quine. ??? 12/1/196 A self-reproducing Befunge program, 13x4. Kevin Vigor 4/9/97 Generates and prints a Serpinsky triangle, a simple type of fractal. Since the resolution is 20x30, the detail of the fractal isn't really visible, but hey, what can you do? Kevin Vigor 4/10/97 Improved Serpinsky Triangle generator. CC0 Dmitry M Litvinov 12/1/96 Program to generate sine wave patterns. Based on cos(a+b)=cos(a)*cos(b)-sin(a)*sin(b) and sin(a+b)=sin(a)*cos(b)+cos(a)*sin(b). sin and cos values are kept in one stack cell = abs(sin) * 2^16 + abs(cos) Kalyna Zazelenchuk 1/1/93 Same as, except sorts the letters of your word in ascending order. ??? 6/1/97 A big surprise. Zach Baker 7/10/97 A real purty 'switch' statement. CC0 Chris Pressey 10/27/11 Tests whether the # instruction interacts properly with wrapping. CC0 Chris Pressey 8/23/11 Tests how your implementation of Befunge-93 calculates modulus (there is no right way.) CC0 Chris Pressey 9/1/93 Converts letters to upper-case. An example of the ` (greater) statement. CC0 Wim Rijnders 8/15/97 The classic game of Hunt the Wumpus!