Befunge · Lesson 1 · On the house

A two-dimensional language

IP moves on a playfield. Lesson 1 is free — on the house.

Lessons · Befunge · Lesson 1 of 10 · On the house

A two-dimensional language

IP moves on a playfield.

Illustration for the Befunge course
Lesson 1 is on the house. The rest opens with the paper, the Daily, or a gift.

Befunge is a two-dimensional esoteric language. The instruction pointer (IP) moves on a grid called the playfield. Directions change how code flows — not only top-to-bottom. Classic Befunge-93 treats the playfield as both code and data.

Most languages are one-dimensional streams of tokens. Befunge places commands on a plane. The IP has a position and a direction. Each step it executes the cell underfoot, then moves.

< ^ v steer east, west, north, south. Crossing paths is a feature — and a hazard — because the same cell might be visited on different trajectories.

Chris Pressey created Befunge in 1993. It is intentionally awkward in places: self-modification, wrapping, and stack discipline. Awkwardness forces you to simulate state.

Hold three cursors in mind: IP row/column, IP direction, and the stack. Draw them. Without a drawing, later lessons become guessing games.

Dialects exist (Befunge-93, Befunge-98, variants). We teach classic Befunge-93 habits: playfield, directions, stack, . and ,, stringmode, # bridge, g/p, _ and |, and @ to end.

Why study it? Spatial control flow makes ordinary if/while feel newly clear by contrast. Stack machines teach operand order with nowhere to hide.

Comments in our stills may use # lines as notes — but # in real Befunge is the bridge command. Know which still is documentary versus executable. Today's still is a mental-model note.

Open-book quizzes test Befunge itself. Match exercises to the still. Predict before you run an interpreter.

Hold A two-dimensional language as a behavior, not a vocabulary flashcard. Ask: what inputs matter, what action runs, what is visible afterward? If you cannot fill those three slots, you are skimming. Write them in a margin before the quizzes.

When something fails around A two-dimensional language, change one thing. Read the error or the wrong output. Return to the still. Do not rewrite the whole example when one token is wrong. Calm retries beat dramatic rewrites.

Compare A two-dimensional language with the nearest habit you know from C, Python, or plain English — and name the difference out loud. Befunge's teaching value is often the delta: familiar family, different ergonomics.

Open-book checks for A two-dimensional language reward careful reading of this page, not trivia about the website chrome. The right answer is a claim we actually made. Near-miss choices sound technical; they fail because they invert the lesson.

Before the still, predict. After the still, compare. That predict-compare loop is how A two-dimensional language becomes muscle memory. Passive rereading without prediction is how you forget by tomorrow.

Say a one-sentence teaching version of A two-dimensional language you could give a friend. If the sentence needs five caveats, your mental model is still foggy — tighten it. Precision in speech precedes precision in code.

As you continue, A two-dimensional language will reappear inside larger programs. Functions wrap it. Branches choose it. Loops repeat it. Learning it cold now prevents cargo-cult pasting later.

Keep a scratch note for A two-dimensional language: one worked example, one failure you fixed, one sentence of definition. That tiny notebook beats highlighting the same paragraph five times.

If you are tired, stop at the still for A two-dimensional language and trace tokens with a finger: type, keyword, operator, semicolon. Rushing past tokens is how mysteries are born. Slow eyes make fast programmers.

Wrong answers on A two-dimensional language quizzes are teachers too. Read the explain line. Relate it back to the still. A corrected misconception sticks harder than a lucky first guess.

Emulators, archives, and dialect notes may disagree on edges around A two-dimensional language. We teach the classic shape on this page. When you port elsewhere, read that environment's docs and adjust — without abandoning the core idea.

Finally for A two-dimensional language: write the still from memory on paper, then uncover the page and diff. Memory retrieval is the study method that survives the weekend.

Worked example mindset for A two-dimensional language: shrink the idea until you can execute it on a napkin. If the napkin proof fails, the full program will not save you. Enlarge only after the tiny case is honest.

Common confusion near A two-dimensional language: mixing the name of the idea with a neighboring idea from C or Python. Write one contrast sentence — "this is X, not Y" — and keep it beside the still. Contrast sentences prevent weeks of soft bugs.

Practice drill for A two-dimensional language: change one literal in the still by a small delta, recompute the expected result by hand, then confirm. Single-delta drills expose off-by-ones and wrong-type assumptions faster than rereading the same paragraph.

Teaching standard for A two-dimensional language: you should be able to explain precondition, action, and postcondition without looking. If any of those three is fuzzy, that fuzzy slot is the real lesson hiding inside the lesson.

Host-teacher note for A two-dimensional language: I will not rush you, but I will not dilute the subject either. Read once for the story, once for the mechanism, once with the still under your finger. Three passes beat one skim.

Transfer test for A two-dimensional language: explain it to a skeptical friend who only knows Python or C. If they can predict the still's effect from your explanation, you own it. If they cannot, your explanation was vocabulary without behavior.

Edge inventory for A two-dimensional language: list one normal case, one boundary case, and one misuse. Boundaries and misuses are where quizzes live and where production bugs breed.

2d

# Befunge playfield
# IP moves: > < ^ v
Playfield mental model.

Two comment-style lines name the playfield and the direction glyphs. This still teaches the model, not a running program. Recite: 2D grid, IP, directions.

Pitfalls: treating Befunge as 1D C; confusing documentary # notes with the bridge command; forgetting the stack; assuming code-only playfield; skipping drawings.

Quiz

What is distinctive about Befunge?

Quiz

What do > < ^ v typically do?

Quiz

Is the playfield only code in classic Befunge?

Quiz

What three things should you draw?

Quiz

Who created Befunge?

Quiz

Why is awkwardness part of the pedagogy?

Check

Match the still for: A two-dimensional language.

Model acquired. Next: steer the IP with direction commands.

Open-book: the answers are on this page. Pass every quiz and check (7) to mark the lesson done. This visit: 0/7.

A two-dimensional language · Befunge (free) — The Gold Standard