Start here
Befunge Programming Techniques Overview
A tour of the recurring patterns that give Befunge programs structure: loops, branches, skips, strings, input, grid storage, subroutines and layout habits.
Programming in Funge
Everyday patterns for writing readable Befunge programs.
Start here
A tour of the recurring patterns that give Befunge programs structure: loops, branches, skips, strings, input, grid storage, subroutines and layout habits.
Follow a two-row Befunge countdown from 9 to 1 one step at a time, with the stack contents and pointer direction written out at every instruction.
How Befunge's two if instructions pop the top of the stack and steer the pointer, with a small example, comparison tips and common layout mistakes.
What the Befunge # instruction does, how it skips exactly one cell in any direction, and the loop and layout tricks it makes possible.
Practical spacing, alignment and sectioning habits that make a two-dimensional Befunge program easier to follow, trace and change without breaking it.
How Befunge's double-quote instruction pushes character codes, why strings come out backward, and three reliable ways to print text in the right order.
How the ampersand and tilde instructions read numbers and characters in Befunge, how to convert digit characters to values, and what to watch for at end of input.
Befunge has no call instruction, so reusable routines are emulated. Compare copying code, dispatching a return with a stack value, and rewriting cells.
How Befunge's g and p instructions turn spare grid cells into named variables, with argument order, a counter example and tips for avoiding collisions.
Build counted and conditional loops in Befunge by routing the pointer back over earlier cells, with tested-first and tested-last layouts and common pitfalls.
Related topics