Hexagrid
Sixteen hex digits on a grid you never see. Walk a pointer to each one in your head, push it, and pairs of digits become letters.
Emil Svensson, 2008 · Turing complete: no · ●○○ easy · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
Emil Svensson made Hexagrid in 2008, and the name is short for hexadecimal grid. The grid holds the digits 0 to F, four to a row, and a pointer starts on 0. A program can only move the pointer and push the digit under it, so to print an H you walk down to 4, push, walk down to 8 and push again. The specification says the grid is never shown while coding. You keep track of the pointer in your head.
Read the story
There are no loops, no input and no arithmetic, so a program prints the same text every time.
The machine
0 1 2 3
4 5 6 7
8 9 A B
C D E F
| Char | Does |
|---|---|
> < ^ v | Move the pointer |
+ | Push the digit under the pointer |
! | Empty the stack and put the pointer back on 0 |
o | Print the stack |
name{...} | Run the commands on the stack called name |
The Hello World prints the text its digits spell, while its first example prints A from a stack that holds the one digit A. This implementation does both. Digits print two at a time as characters, and a digit left over at the end prints as itself. A pointer that walks off the grid comes back on the other side, which the specification leaves open.
Example
The Hello World pushes 24 digits, 48656C6C6F20576F726C6421, and they print as 12 characters.
The Hello World pushes 24 digits, 48656C6C6F20576F726C6421, and they print as 12 characters. The last one walks to 4 and 8 for the H, then up to 4, right to 6 for the 6, and one left and one down to 9, which spells 4869.
Patterns it teaches
- Encoding tricks: text written as a walk over its own hex codes.
Further
See also
Also in Jokes
Write your own in Run Convert a program from Hexagrid
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: hexagrid.
Command line
shib run hexagrid -e 'myStack{!>>vv+o};'shib manual hexagridSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/hexagrid.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org