No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Mike Schwörer 5a259397b1
more bigint stuff
11 months ago
.gitignore added gcd 1 year ago
Almosted-Sorted-Distinct.b93 Added Almost-Sorted-Distinct 3 years ago
ConcatenateNumbers.b93 Initial commit 3 years ago
DecodeBase9-2.b93 Initial commit 3 years ago
DecodeBase9.b93 Initial commit 3 years ago
Exponentiation.b93 Initial commit 3 years ago
Exponentiation_from_get.b93 added exponentiation (with exponent from field) 1 year ago
FacDigitSum.b93 Initial commit 3 years ago
Fixed_Base_Pow.b93 Added multiple snippets (used by euler-098) - fixed_base_pow.b93 - get_palindromic_hash.b93 - read_single_word.b93 - length_single_word.b93 2 years ago
GenerateRandom.b93 Initial commit 3 years ago
GenerateRandom_compressed.b93 Initial commit 3 years ago
GetCombinatoricHash.b93 Initial commit 3 years ago
HelloWorld.b93 Initial commit 3 years ago
HelloWorld_obfuscated.b93 Initial commit 3 years ago
Improbable.b93 Initial commit 3 years ago
LICENSE.txt Add README and LICENSE 2 years ago
Miller-Rabin primality test (big).b93 Initial commit 3 years ago
Miller-Rabin primality test.b93 Initial commit 3 years ago
Primetest.b93 Initial commit 3 years ago
README.md Add README and LICENSE 2 years ago
RandomChess-2.b93 Initial commit 3 years ago
RandomChess.b93 Initial commit 3 years ago
Sieve-Of-Eratosthenes-with-collector (v2).b93 Sieve-Of-Eratosthenes-with-collector (v2) 3 years ago
Sieve-Of-Eratosthenes-with-collector.b93 Initial commit 3 years ago
Sieve-Of-Eratosthenes.b93 Initial commit 3 years ago
StackReverse.b93 Initial commit 3 years ago
Windmill.b93 Initial commit 3 years ago
bigint_add.b93 more bigint stuff 11 months ago
bigint_mult.b93 bigint_mult (long multiplication) 11 months ago
bigint_sub.b93 more bigint stuff 11 months ago
calcBase4Random.b93 Initial commit 3 years ago
continued_squareroot_fraction.b93 Initial commit 3 years ago
gcd.b93 added gcd 1 year ago
gcd_multi.b93 added gcd 1 year ago
get_palindromic_hash.b93 Added multiple snippets (used by euler-098) - fixed_base_pow.b93 - get_palindromic_hash.b93 - read_single_word.b93 - length_single_word.b93 2 years ago
gnome_sort.b93 Initial commit 3 years ago
integer-squareroot-2.b93 Initial commit 3 years ago
integer-squareroot.b93 Initial commit 3 years ago
is-squarenumber.b93 Initial commit 3 years ago
is_pandigital.b93 is_pandigital 11 months ago
length_single_word.b93 Added multiple snippets (used by euler-098) - fixed_base_pow.b93 - get_palindromic_hash.b93 - read_single_word.b93 - length_single_word.b93 2 years ago
normalize_exponentiation.b93 Added normalize_exponentiation.b93 2 years ago
read_single_word.b93 Added multiple snippets (used by euler-098) - fixed_base_pow.b93 - get_palindromic_hash.b93 - read_single_word.b93 - length_single_word.b93 2 years ago
stack-array-count.b93 Initial commit 3 years ago
stack-array-sum.b93 Initial commit 3 years ago
sudoku.b93 added gcd 1 year ago

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.