a collection of some befunge programs I have written (see also the collection of my befunge project-euler solutions)
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
Almosted-Sorted-Distinct.b93
ConcatenateNumbers.b93
DecodeBase9-2.b93
DecodeBase9.b93
Exponentiation.b93
Exponentiation_from_get.b93
FacDigitSum.b93
Fixed_Base_Pow.b93
GenerateRandom.b93
GenerateRandom_compressed.b93
GetCombinatoricHash.b93
HelloWorld.b93
HelloWorld_obfuscated.b93
Improbable.b93
LICENSE.txt
Miller-Rabin primality test (big).b93
Miller-Rabin primality test.b93
Primetest.b93
README.md
RandomChess-2.b93
RandomChess.b93
Sieve-Of-Eratosthenes-with-collector (v2).b93
Sieve-Of-Eratosthenes-with-collector.b93
Sieve-Of-Eratosthenes.b93
StackReverse.b93
Windmill.b93
bigint_add.b93
bigint_mult.b93
bigint_sub.b93
calcBase4Random.b93
continued_squareroot_fraction.b93
gcd.b93
gcd_multi.b93
get_palindromic_hash.b93
gnome_sort.b93
integer-squareroot-2.b93
integer-squareroot.b93
is-squarenumber.b93
is_pandigital.b93
length_single_word.b93
normalize_exponentiation.b93
read_single_word.b93
stack-array-count.b93
stack-array-sum.b93
sudoku.b93

README.md

My Befunge-93 programs

This is an unsorted collection of some befunge-93 programs I have written.

Some files contain complete programs and some contain only snippets or modules.

Notable programs include:

  • sudoku.b93
  • continued_squareroot_fraction.b93
  • gnome_sort.b93
  • Miller-Rabin primality test.b93
  • Sieve-Of-Eratosthenes-with-collector (v2).b93

Notes

  • For some of the longer programs (err ... like ... all of them) use BefunExec or a similar fast interpreter. (Your interpreter should support int64 numbers for some programs)
  • I generally like to write Befunge-93 syntax. Unfortunately the '93 variant is not turing complete due to its restriction of a 80x25 size. I simply chose to ignore that restriction in the programs where I hit the limit (but I still try to compress my programs as much as possible). You could argue that - because of that - some programs are technically Befunge-98 (with a severe limited instruction set).

Overview

######Almosted-Sorted-Distinct Replaces all repeated values in an array with zero. Works best on (almost) sorted lists (otherwise this is O(n^2))

######calcBase4Random Get a random number between 0 and 4^n

######ConcatenateNumbers Textually concatenate two numbers (eg: 648 o 120 = 648120)

######continued_squareroot_fraction Calculate the continued fraction of a square root

######DecodeBase9 Calculates a number where its digits (int base-9) lie reversed on the stack

######DecodeBase9-2 Calculates a number where its digits (int base-9) lie in normal order on the stack

######Exponentiation The Pow() function

######FacDigitSum Calculates the sum of the factorials of a digit

######GenerateRandom Get a random number between 0 and 4^n

######GenerateRandom_compressed Get a random number between 0 and 4^n

######GetCombinatoricHash Calculates a combinatoric hash value (the digit order is ignored).

######gnome_sort Implementation of gnome sort. Gnome sort is not fast but simple to implement.

######HelloWorld Print hello world

######HelloWorld_obfuscated Print hello world

######Improbable Runs for a random - but long - time

######integer-squareroot Calculates the integer-squareroot of a number

######integer-squareroot-2 Calculates the integer-squareroot of a number

######is-squarenumber Tests if an integer is a square number (really fast by deploying a number of numerical "tricks")

######Miller-Rabin primality test An implementation of the Miller-Rabin primality test for numbers 0 < n < 1,373,653

######Miller-Rabin primality test (big) An implementation of the Miller-Rabin primality test for numbers 0 < n < 3,825,123,056,546,413,051

######Primetest A pretty basic primality test

######RandomChess A big cube of ? instructions

######RandomChess-2 A big cube of ? instructions

######Sieve-Of-Eratosthenes A implementation of the sieve of eratosthenes

######Sieve-Of-Eratosthenes-with-collector A implementation of the sieve of eratosthenes where we collect the found primes in a continuous memory region

######Sieve-Of-Eratosthenes-with-collector (v2) A implementation of the sieve of eratosthenes where we collect the found primes in a continuous memory region

######stack-array-count Calculate the count of stack values (Null-terminated)

######stack-array-sum Generate sum of stack values (Null-terminated)

######StackReverse Reverse the values on the stack

######sudoku A Sudoku solver (see my blogpost about this program)

######Windmill A test program for BefunExec.