Programming in Funge

Algorithms in Funge

Classic algorithms worked through on a grid.

Computing Factorials on a Grid

Build a small Befunge factorial program with a loop, a scratch cell and a pass-by-pass table showing the stack and accumulator at every step.

4 min read

Converting Numbers Between Bases

Convert a number to binary in Befunge by repeated division, then fix the backward digit order by letting the stack hand the digits back in reverse.

4 min read

Reversing a String with the Stack

Read characters until a newline, push them on the Befunge stack, then pop and print them backward, using the stack's own ordering to do the reversal.

4 min read

Sorting Small Lists in a Grid Language

Without arrays, a Befunge sort stores values in grid cells and compares them pair by pair. See a tested compare-and-order routine and what a full sort costs.

5 min read

Testing for Primes by Trial Division

A tested Befunge program checks whether a number is prime by trying each divisor in turn, and the article explains its limits in such a small language.

4 min read

Writing a Quine in a Grid Language

A 14-cell Befunge quine reads its own cells with get and prints them, showing how the playfield doubles as data. Includes a cell-by-cell explanation.

4 min read

Related topics

More in programming in funge