Getting Started
Simple Funge instructions
- 2 pushes the number 2 onto the stack. Any number from 0-9 can be pushed onto the stack - larger numbers are made by pushing smaller numbers and adding or multiplying them.
- + pops two numbers off the stack, adds them, and pushes the result back onto the stack.
- . pops a number off the stack and prints it to the console.
- @ exits the Funge program.
Addition example
Try typing the following code into BeQunge:
23+.@
Press the Debug button on the BeQunge toolbar and watch the interpreter run your code. Two numbers (2 and 3) will be pushed onto the stack. These will be added together and the result (5) printed to the console.
You can slow down execution of your code by using the speed slider. You can also press the Pause button next to the slider and step through your code using the Step button on the toolbar.
Multi-dimensional code
Funge is a multi-dimensional programming language. The instruction pointer is a vector and can travel in any direction through your code. You can use the following instructions to change the direction of the instruction pointer:
- > right. This is the default direction.
- < left.
- ^ up.
- v down.
- h into the screen (high).
- l out of the screen (low).
Notice that when typing these instructions in the editor window, BeQunge will change the direction of text input for you. The arrow at the bottom of the screen will change to reflect which direction text is being entered. You can change this manually by holding Alt and pressing an arrow key.
When you enter a h or l instruction, BeQunge will rotate the view to make it easier to see the plane you're working in. You can rotate the view manually by pressing Tab. You can also use the Page Down and Page Up keys to move the text cursor back or forward through your three dimensional code.
More than three dimensions
Additional dimensions can be shown by pressing Ctrl+Up. This will "zoom out", showing the three-dimensional space you are currently editing in the center of the screen, surrounded by an infinite number of other three-dimensional spaces. You can use the Up, Down, Left, Right, Page Up and Page Down keys to select another three-dimensional space that you want to edit, and then press Ctrl+Down to "zoom in" to it.
Currently BeQunge is limited to displaying about 105 dimensions.
There are two instructions used by BeQunge to move between these higher dimensions. Note that these instructions are non-standard and do not appear in the Funge-98 specification.
- Z pops a number n off the stack and makes the instruction pointer travel forwards in the nth dimension.
- Y pops a number n off the stack and makes the instruction pointer travel backwards in the nth dimension.
Dimensions are numbered beginning from 0, so 0Z would travel forwards in the x dimension, and 1Y would travel backwards in the y dimension.
Additional resources
More examples
You can find more example programs on the downloads page.
Funge reference
The Funge-98 Final Specification contains documentation on all Funge instructions. Note that some Funge-98 instructions are not yet implemented in BeQunge, and others may behave differently than stated in the specification.