Project 4 — Text Adventure
The classic first game — and a great state machine. Parse typed commands, walk a grid, and collect items, updating the world one turn at a time.
Build the four steps, then assemble play(commands) — a reducer that folds a
list of commands into a final {"position", "inventory"}.
- Step 1 —
parse_command: text → normalised words. - Step 2 —
move: walk the grid, clamped to the edges. - Step 3 —
take: pick up an item (no duplicates). - Step 4 —
describe: render a room to a sentence.
Skills: string parsing, conditionals/dispatch, clamping, lists + membership, f-strings — a real loop-over-input program.
