Wumpus
A Fungeoid on a grid of triangles, with twenty registers on a die that rolls across the code.
Martin Ender, 2018 · Turing complete: yes · ●●● hard · esolangs.org
Tested with 4 known programs · Hello World on Try It Online: identical · Test method
Run it
The idea
Martin Ender made Wumpus in 2018. It is a stack language in the line of Befunge and ><>, but the grid is made of triangles. The cell at (x, y) points up when x + y is even and down when it is odd. The pointer always crosses an edge, so it can move in six directions, and a diagonal path is a staircase in the source text.
Read the story
The grid does not wrap. The edges of the program reflect the pointer, so a program on one line runs to its end and comes back the same way.
The name comes from Hunt the Wumpus, a game whose dungeon is an icosahedron. Wumpus has one too, a d20 with a register on each of its 20 faces. It can sit on the grid and roll from cell to cell, copying cells into its faces or its faces into the code.
The machine
One stack of big integers, with endless zeros below. The pointer starts at the top left moving east.
| Char | Does |
|---|---|
" | String mode, which pushes every cell up to the next " |
# 0-9 | # pushes 0 and starts int mode, where each digit is appended to the top number |
( ) ! ' | Decrement, increment, not, negate |
+ - * : % | Arithmetic, where : and % round towards minus infinity |
n a v x | Bitwise not, and, or, xor |
_ \| / \ | Mirrors |
{ } ^ | Turn 60 degrees left or right, or pop and turn right if positive |
, | Strafe, so the next step goes sideways |
& $ ? | Pop n and run the next cell n times, skip it, pop and skip it if 0 |
. | Pop y and x and jump there |
i I o O N | Read a byte or a number, print a byte, a number or a newline |
; = ~ l r [ ] | Drop, dup, swap, depth, reverse, rotate |
S L F | Store into the active face, load it, push its number |
A B C P Q R V W X Y Z | Turn the icosahedron in one of eleven fixed ways |
T U D | Tip it by the sign of the top, tip it at random, roll it at random |
g s e | Put it on a cell in get or set mode, take it off |
< > b d p q | Roll it to a neighbouring cell |
G | Rotate the six cells around a vertex |
@ | End |
Example
The Hello World pushes the message backwards, l pushes the depth 13, and & runs o 13 times.
The Hello World pushes the message backwards, l pushes the depth 13, and & runs o 13 times.
The quine from the reference repository relies on the bounce. The string runs to the right edge and comes back, so it is pushed twice, once each way. Then #34 adds a quote, and 9 prints close the loop.
Patterns it teaches
- Two-dimensional control flow: six directions instead of four, and walls instead of wrapping.
- Stack machines: a Fungeoid stack, with twenty registers on the side.
- Self-modifying code: the icosahedron in set mode writes into the grid.
Further
- esolangs.org/wiki/Wumpus
- The reference interpreter, in Ruby, with the full spec
See also
Two-dimensional languages
Stack-based
Write your own in Run Convert a program from Wumpus
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: wumpus.
Command line
shib run wumpus -e '"#34#9&o@'shib manual wumpusSource
- Module
langs/tio/ports.js- Interpreter
langs/tio/wumpus.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org