🕯️ CAVE-K — Cave Treasure Hunt

Write a route in Forth and collect every coin before the torch goes out. Each step pauses for animation, then the Task resumes.

☺
How to play

Goal: walk over every coin ◆ to collect it. Each successful step uses one unit of torchlight; bumping a wall costs nothing. You fail when the torch runs out.

n s e w move one step north, south, east, or west. n? s? e? w? leave 1 on the stack if that direction is blocked by a wall, otherwise 0.

Define new words with : name … ; (for example : dash e e e ;), repeat with 3 for … next, branch with … if … else … then, and start comments with \ . The game grows these control words from the Project-K API. Fewer Forth words means a better score.

This browser version is adapted from the terminal CAVE game; Level 2 keeps the original maze.