This is Befunge · Medium, lesson 1: Multi-digit arithmetic on the stack. Easy gave you digits, +, *, and wrap. Medium builds constants bigger than a single glyph — the workhorse of real programs.
Befunge Medium · Lesson 1 · On the house
Multi-digit arithmetic on the stack
Build numbers larger than 0–9. Lesson 1 is free — on the house.
Lessons · Befunge Medium · Lesson 1 of 10 · On the house
Multi-digit arithmetic on the stack
Build numbers larger than 0–9.

Classic digits 0–9 push one value each. To make 42 you typically push factors and multiply: 67* is 6, then 7, then multiply → 42. Order matters: top of stack is the second operand for binary ops in classic lore — always draw the stack.
A second pattern is repeated addition: push a base, duplicate, add in a loop. Medium prefers factor multiplication first because it is shorter and easier to verify by hand.
ASCII letters for Hello World are constants. H is 72 = 89* or 8:8*+ depending on taste. Prefer the still's exact form until you can invent your own.
Binary ops pop two values. If the stack underflows, dialects disagree (often push 0). Never rely on underflow as a feature while learning — keep the stack honest.
Division / and modulo % truncate toward zero in classic Befunge-93 lore for positive ints. Probe negatives only after positives are boringly reliable.
Build a tiny constant table on paper: 10, 32 (space), 48 ('0'), 65 ('A'), 97 ('a'). Those five unlock printers and parsers later in this course.
Self-check: can you push 100 without using more than four cells of playfield? If not, practice factor trees before lesson 2.
Hold Multi-digit arithmetic on the stack 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 Multi-digit arithmetic on the stack, change one thing. Read the wrong output. Return to the still. Do not rewrite the whole playfield when one cell is wrong. Calm retries beat dramatic rewrites.
Compare Multi-digit arithmetic on the stack with the nearest habit you know from C, Python, or Forth — and name the difference out loud. Befunge's teaching value is often the delta: familiar family, different ergonomics.
Open-book checks for Multi-digit arithmetic on the stack reward careful reading of this page. The right answer is a claim we actually made about Befunge-93. Near-miss choices sound technical; they fail because they invert the lesson.
Before the still, predict IP position, direction, and stack. After the still, compare. That predict-compare loop is how Multi-digit arithmetic on the stack becomes muscle memory.
Say a one-sentence teaching version of Multi-digit arithmetic on the stack you could give a friend. If the sentence needs five caveats, your mental model is still foggy — tighten it.
Keep a scratch note for Multi-digit arithmetic on the stack: one worked example, one failure you fixed, one sentence of definition. That tiny notebook beats highlighting the same paragraph five times.
Wrong answers on Multi-digit arithmetic on the stack quizzes are teachers too. Read the explain line. Relate it back to the still. A corrected misconception sticks harder than a lucky first guess.
Host-teacher note for Multi-digit arithmetic on the stack: 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.
Edge inventory for Multi-digit arithmetic on the stack: list one normal case, one boundary case, and one misuse. Boundaries and misuses are where quizzes live and where playfield bugs breed.
Transfer test for Multi-digit arithmetic on the stack: explain it to a skeptical friend who only knows Python. If they can predict the still's effect from your explanation, you own it.
Practice drill for Multi-digit arithmetic on the stack: change one cell in the still by a small delta, recompute the expected stack and IP by hand, then confirm. Single-delta drills expose off-by-ones faster than rereading.
Invariant for Multi-digit arithmetic on the stack: state precondition and postcondition as stack shape plus IP direction. If either side is vague, the idiom is not ready to nest.
Numeric drill on Multi-digit arithmetic on the stack: pick three small inputs and fill a table of resulting stacks by hand. Tables catch wrap and pop-order mistakes a single example hides.
Naming for Multi-digit arithmetic on the stack: label lanes TRUE/FALSE/JOIN on graph paper even though the playfield has no labels. Update when lanes rotate; stale labels lie.
Stop condition for Multi-digit arithmetic on the stack: say what makes the path halt or rejoin. If you cannot, you do not control it. @ is native halt — design for it.
Minimal still for Multi-digit arithmetic on the stack: delete commands until the teaching point breaks, then put one back. Remember the minimal still, not the longest golf.
Teach-back for Multi-digit arithmetic on the stack: explain the still to an empty chair with only a stack sketch. Hesitation marks the exact gap to restudy.
Negative space for Multi-digit arithmetic on the stack: list what the idiom does not do — no implicit pops, no free direction memory, no automatic rejoin. Negatives prevent false expectations.
Pointer chant for Multi-digit arithmetic on the stack: after each opcode in the still, say the direction and top-of-stack aloud. Embarrassment is cheaper than an hour lost on a drifted IP.
fortytwo
67*aitch
89*Trace 67*: push 6, push 7, multiply → 42. Trace 89*: push 8, push 9, multiply → 72. Same shape, different product.
Pitfalls: reversing operand order on paper; treating underflow as defined; golfing before you can factor 42 by hand; confusing ASCII code with the character glyph on the playfield.
Quiz
How do you typically push 42 with digit glyphs?
Quiz
What does 89* leave on the stack?
Quiz
Why keep a constant table (10, 32, 48, 65, 97)?
Quiz
What should you do on stack underflow while learning?
Quiz
Operand order for binary ops?
Quiz
Best first path to multi-digit constants?
Check
Type the 42 still.
Constants unlocked. Next: structured branch diamonds that rejoin cleanly.
Open-book: the answers are on this page. Pass every quiz and check (7) to mark the lesson done. This visit: 0/7.