De Befunge Busy Beaver
This page contains a Befunge interpreter. Befunge is an esoteric programming language: programs are arranged on a two-dimensional grid, and arrow instructions direct flow of control. The befunge interpreter on this page is a simplified one, as used in the ALTEN PTS Brein Breker puzzle by Mathijs Romans in the magazine Bits & Chips (2011 sept 23). For a full implementation see e.g. flogisoft, and for sample programs see quadium.
The goal of the puzzle is to write a program in a 5 by 5 grid that starts at the upper left corner and ends at the lower right, but makes as many steps as possible. The puzzle comes with an program that takes 87 steps. After some puzzling I got to over 3000 steps. But it turned out that 60 thousand steps is also possible (see solution).
- ^ Change direction to North
- > Change direction to East
- v Change direction to South
- < Change direction to West
- (space) Do nothing
- 9 Push 9 onto the stack
- + Increment top of stack by 1
- - Decrement top of stack by 1
- $ Pop (remove top of stack)
- \ Swap upper two stack values
- _ Equals < when top of stack is positive, otherwise >
- | Equals ^ when top of stack is positive, otherwise v
- @ Ends program