# 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

anagram.bf 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 'rand2.bf' to generate random numbers.

aturley.bf CC0 Andrew Turley 1/1/2999 aturley's .sig; cellular automata gasket generator.

beer.bf 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.

beer10.bf Chris Lahey 6/8/97 A squashed (22x10) beer singing program, gramatically correct.

beer2.bf Keith Arner 4/10/97 Another "99 Bottles of Beer" program.

beer3.bf Chris Lahey 4/11/97 Another singing algorithm.

beer4.bf Denis Moskowitz 4/11/97 Yet another singing algorithm.

beer5.bf David Johnston 4/11/97 Another singing program.

beer6.bf Chris Lahey 4/11/97 A crammed (14x21) singing program.

beer7.bf CC0 Wim Rijnders 5/2/97 A beer bottling program.

beer8.bf CC0 Wim Rijnders 5/12/97 Again with the bottles.

beer9.bf David Johnston 5/13/97 Crammed (22x9) singing beer program which doesn't use good grammar or punctuation.

befbef.bf 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.

befbef2.bf CC0 Wim Rijnders ?/?/00 A version of befbef.bf with some bugs (pointed out by Amir Karger) fixed.

befunge1.bf Denis Moskowitz 7/17/97 Befunge logo source.

befunge2.bf Sam Holden 7/17/97 Befunge logo source.

befunge3.bf Ben Olmstead 7/18/97 Befunge logo source.

befunge4.bf Kevin Vigor 8/13/97 Befunge logo source.

befungex.bf Kevin Vigor 7/18/97 Non-standard (oversize) Befunge logo source.

calc.bf 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.

cascade.bf CC0 Chris Pressey 7/20/97 Like copyme.bf, but continues to replicate itself.

chars.bf Kalyna Zazelenchuk 1/1/93 Generates a printable ASCII table, with characters and corresponding codes in decimal, from 34 to 127.

copyme.bf CC0 Wim Rijnders 6/5/97 Program which reproduces itself in Befunge-space.

digitalr.bf Keymaker 9/3/08 Computes the digital root (see numer.bf) of the input.

dladv.bf 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

drx.bf CC0 Chris Pressey 1/1/93 "Like Eliza, except better :-)"

ea.bf 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.

easm.bf CC0 Chris Pressey 1/1/93 Same as 'ea.bf', but uses self-modifying code.

euclid.bf Greg Wright 6/5/97 Euclidean algorithm.

fact.bf CC0 Chris Pressey 1/1/93 Asks for a number, and supplies the factorial of that number.

fact2.bf Jason Reed 5/18/97 Factorial generator, (3x12)

fact3.bf Chris Lahey 6/8/97 (23x1) factorial generator.

hello.bf CC0 Chris Pressey 1/1/93 The ubiquitous "Hello, World!" program.

hex.bf CC0 Chris Pressey 1/1/93 Translates ASCII input into hex output.

hwii.bf 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.

kmquine.bf Keymaker 9/3/08 The first of a series of really fine quines (self-printing programs) by Keymaker.

kmquine2.bf Keymaker 9/3/08 The second of a series of really fine quines by Keymaker.

kmquine3.bf Keymaker 9/3/08 The third of a series of really fine quines by Keymaker.

life.bf CC0 Dmitry M Litvinov 6/1/97 An implementation of John Conway's game of Life.

madd.bf Greg Wright 6/5/97 3x3-Matrix Addition

mandel.bf Chris Lahey 4/11/97 A Mandelbrot fractal generator.

maze.bf CC0 Chris Pressey 1/1/93 A conversion of a Commodore-64 graphical pastime: a dead-simple random maze generator.

namegame.bf 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.

numer.bf 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".)

pairing.bf 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.

pangram.bf 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.

pascserp.bf CC0 Chris Pressey 7/12/97 Generates a gasket (Serpinsky triangle) using Pascal's Triangle.

pi.bf 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.

pi2.bf 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.

prime.bf Kalyna Zazelenchuk 1/1/93 Lists the counting numbers incrementally from one and checks if each is prime.

rand.bf Chris Pressey 1/1/93 Generates random numbers between 1 and 9 as statistically evenly distributed as the computer's random number generator.

rand10.bf Ken Bateman 4/12/97 A 3x10 random number generator.

rand11.bf 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.

rand12.bf Ben Olmstead 4/24/97 A 2x13, 0..255 random number generator.

rand13.bf Ben Olmstead 4/24/97 A 2x12, infinitely looping 0..31 random number generator.

rand14.bf Greg Wright 5/18/97 4x7 random number generator.

rand15.bf Artyom Baranov 4/5/96 THE smallest Befunge RNG-16. (16x1)

rand2.bf Kalyna Zazelenchuk 1/1/93 This program, crammed into a 14x14 block, makes random numbers from 1 to 16 using multiple "?" statements.

rand3.bf Chris Pressey 1/1/93 12x9 random number generator, like rand.bf and rand2.bf.

rand4.bf Matthew D Moss 2/1/96 A 7x7 random number generator in the tradition of rand.bf .. rand3.bf, but using mathematics to reduce the problem before writing the code

rand5.bf CC0 Dmitry M Litvinov 2/1/96 A 4x10 random number generator which produces the same output as rand.bf .. rand4.bf. Unlike most Befunge sources this one has a symmetrical beauty to it.

rand6.bf Artyom Baranov? 12/1/96 An 8x4 random number generator a la rand5.bf.

rand7.bf ??? 12/1/96 A 13x3 random number generator a la rand5.bf and rand6.bf.

rand8.bf 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.

rand9.bf Chris Lahey 4/11/97 A 3x7 random number generator.

rdp.bf CC0 Dmitry M Litvinov 2/1/96 A command-line calculator with postfix notation.

rdp2.bf Kimberley Burchette 12/1/96 A version of rdp.bf crammed into a 23x12 block.

robot.bf 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 '*'.

rot13.bf ??? 9/11/97 Performs the rot13 algorithm.

selflis2.bf CC0 Chris Pressey 12/1/96 A self-reproducing 80x1 program. This program can also be used to test for the @ vs StringMode bug.

selflis3.bf Kevin Vigor 5/28/97 A 14-byte Quine (self-reproducing program.)

selflis5.bf David Johnston 5/7/97 Crammed (14x6) self-listing program.

selflis6.bf Denis Moskowitz 5/8/97 14-byte quine.

selflist.bf ??? 12/1/196 A self-reproducing Befunge program, 13x4.

serp.bf 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?

serp2.bf Kevin Vigor 4/10/97 Improved Serpinsky Triangle generator.

sinus.bf 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)

sort.bf Kalyna Zazelenchuk 1/1/93 Same as anagram.bf, except sorts the letters of your word in ascending order.

surprise.bf ??? 6/1/97 A big surprise.

switchbx.bf Zach Baker 7/10/97 A real purty 'switch' statement.

testbrdg.bf CC0 Chris Pressey 10/27/11 Tests whether the # instruction interacts properly with wrapping.

testmodu.bf CC0 Chris Pressey 8/23/11 Tests how your implementation of Befunge-93 calculates modulus (there is no right way.)

toupper.bf CC0 Chris Pressey 9/1/93 Converts letters to upper-case. An example of the ` (greater) statement.

wumpus.bf CC0 Wim Rijnders 8/15/97 The classic game of Hunt the Wumpus!