Recipe Card
Served Output
Nothing has been served yet.
Ingredient Shelf
The pantry is empty.
Mixing Bowl
The bowl is clean.
Baking Dish
No dish is prepared.
Chef's Notes
No notes yet.
Cook strange recipes. Serve real output.
Write a recipe that outputs the number 42.
42
Nothing has been served yet.
The pantry is empty.
The bowl is clean.
No dish is prepared.
No notes yet.
Work through these challenges to master stack operations in Chef. Each challenge teaches a new concept. Your progress is saved automatically.
Chef is an esoteric programming language where programs are written as cooking recipes. It was designed by David Morgan-Mar in 2002. Although it looks humorous, it uses real programming concepts: variables, stacks, arithmetic, and output.
In Code Kitchen, you write a Chef recipe in the editor, and the interpreter parses and executes it step by step — so you can see exactly how stacks and variables work behind the scenes.
Every Chef program follows this structure:
value unit name (e.g. 72 g haricot beans).
Each ingredient is a variable with a numeric value. The name can be multiple words (e.g. "haricot beans").
The mixing bowl is a stack (last in, first out). Put pushes to the top. Fold pops from the top. Arithmetic affects the top item only.
The baking dish is the output buffer. Pour copies the bowl contents into the dish. When the program ends, the dish contents become the output.
Liquefy converts numbers to characters using ASCII codes (e.g. 72 → 'H', 101 → 'e'). This is how Chef programs produce text output.
| Command | What it does | Stack operation |
|---|---|---|
Put <ingredient> into the mixing bowl. |
Push ingredient's value onto the stack | PUSH |
Fold <ingredient> into the mixing bowl. |
Pop top value and store it in the ingredient | POP |
Add <ingredient> to the mixing bowl. |
Add ingredient's value to top of stack | top += value |
Remove <ingredient> from the mixing bowl. |
Subtract ingredient's value from top of stack | top −= value |
Combine <ingredient> into the mixing bowl. |
Multiply top of stack by ingredient's value | top ×= value |
Divide <ingredient> into the mixing bowl. |
Divide top of stack by ingredient's value | top ÷= value |
Liquefy contents of the mixing bowl. |
Convert all values in the bowl to characters (ASCII) | chr() |
Stir the mixing bowl for N minutes. |
Roll the top element down N positions | ROTATE |
Pour contents of the mixing bowl into the baking dish. |
Copy bowl contents to the output dish | COPY → dish |
Clean the mixing bowl. |
Empty the bowl (remove all values) | CLEAR |
Refrigerate [for N hours]. |
End execution and serve the output | HALT |
<Verb> the <ingredient>. |
Loop start. If ingredient is 0, skip to the matching loop end. Otherwise enter the loop body. | LOOP START |
<Verb> [the <ingredient>] until <past participle>. |
Loop end. Optionally decrement the ingredient, then jump back to matching loop start. Loop repeats while the start ingredient ≠ 0. | LOOP END |
Serve with <recipe>. |
Call an auxiliary recipe (sub-routine). Its baking dish output merges into the current dish. | CALL |
Chef supports loops using any verb and its past participle. This is how you repeat a block of instructions:
<Verb> the <ingredient>.
— If the ingredient's value is 0, skip to the matching loop end. Otherwise enter the loop.
<Verb> [the <ingredient>] until <past participle>.
— Optionally decrement the ingredient, then jump back to the matching loop start. The past participle must correspond to the verb in the loop start.
Example: dissolve the sugar. starts a loop, and agitate the sugar until dissolved. ends it. "dissolved" matches "dissolve". The loop runs as long as sugar ≠ 0, decrementing it each time.
You can use any verb/past-participle pair: bake/baked, stir/stirred, fry/fried, cook/cooked, etc.
A Chef program can contain multiple recipes. The first recipe is the main program. Additional recipes defined after it are auxiliary recipes that can be called using:
Serve with <recipe name>.
When called, the auxiliary recipe runs with its own ingredients and mixing bowls, but its baking dish output is merged back into the calling recipe's dishes.
Tip: This is similar to calling a function in other languages. The auxiliary recipe name must match exactly (case-insensitive).
Put.Add, Remove, Combine, Divide) to modify values.Liquefy to convert numbers into characters (if you want text output).Pour to copy the bowl contents into the baking dish.Refrigerate to end execution. The baking dish contents become the program output.Tip: Without Liquefy, values are output as numbers. With it, they are output as characters. The value 72 becomes 'H' because chr(72) = 'H' in ASCII.
This recipe adds 5 + 3 and outputs the result:
Number Stew. Ingredients. 5 g apples 3 g pears Method. Put apples into the mixing bowl. Add pears to the mixing bowl. Pour contents of the mixing bowl into the baking dish. Refrigerate for 1 hour. Serves 1.
Put apples → pushes 5 onto the bowl. Bowl: [5]Add pears → adds 3 to the top. Bowl: [8]Pour → copies bowl to dish. Dish: [8]Refrigerate → output is "8"space
33 = !
48 = 0
65 = A
66 = B
67 = C
72 = H
97 = a
98 = b
99 = c
100 = d
101 = e
108 = l
111 = o
114 = r
119 = w
Full table: A-Z = 65–90, a-z = 97–122, 0-9 = 48–57