We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
Hexafunge
Jump to navigation
Jump to search
Hexafunge is a hexagonal esolang by User:Cordership, based on Befunge and Hexagony.
Program structure
The program is in a hexagonal grid, like this:
> . . … . . . . … . . . . . … …
The > is the pointer’s starting point.
Memory
This language has a main stack, a control stack, and a box.
Syntax
| Command | Description |
|---|---|
| > | Go right |
| < | Go left |
| a | Go top-left |
| b | Go top-right |
| c | Go bottom-left |
| d | Go bottom-right |
| ? | Pop top of main stack, if value=0 turn 60° clockwise, else turn 60° counterclockwise. |
| ! | Pop top of main stack, if value=0 turn 60° counterclockwise, else turn 60° clockwise. |
| ' | Pop top of main stack, if value=1 do like >, if value=2 do like d, if value=3 do like c, if value=4 do like <, if value=5 do like a, if value=6 do like b, else NOP.
|
| ` | Random direction. |
| & | Get integer from user and push it into the main stack. |
| ~ | Get character from user and push it into the main stack. |
| . | Pop top of main stack and output as integer. |
| , | Pop top of main stack and output as ASCII. |
| 0-9 | Push the corresponding number into the main stack. |
| + | Pop values a and b, push the result of a+b into the main stack. |
| - | Pop values a and b, push the result of b-a into the main stack. |
| * | Pop values a and b, push the result of a*b into the main stack. |
| / | Pop values a and b, push the result of b/a, rounded down into the main stack. |
| % | Pop values a and b, push the result of b%a into the main stack. |
| ^ | Pop values a and b, push the result of ba into the main stack. |
| r | Pop values a and b, push b a times into the main stack. |
| " | Toggle string mode in the main stack. |
| \ | Swap top main stack values. |
| K | Duplicate top main stack value. |
| : | Pop top of main stack and push it into the ctrl stack. |
| ; | Pop top of ctrl stack and push it into the main stack. |
| I | Increment the box. |
| D | Decrement the box. |
| A | Pop everything in the main stack and print them as integers separated by spaces. |
| G | Pop values a and b, if b>a push 1, else push 0. |
| L | Pop values a and b, if b<a push 1, else push 0. |
| P | Pop everything in the main stack and print them as ASCII. |
| $ | Pop top of main stack and discard. |
| # | Skip the command right ahead of it in the current direction. |
| E | Pop values a and b, if a=b push 1, else push 0. |
| H | Pop the box and push it into the stack. |
| F | Pop top of stack and push it into the box. |
Has wrapping by default.
Programs
Hello, World!
" ! d l r o W , o l l e H " P @
Cat program
~ ,
Truth-machine
& d ? > 1 . c 0 a < . @
Infinite loop
> d b c a <
One time cat
~ , @
4-function calculator
" / 4 * 3 - 2 + 1 r o t a l u c l a C e g u n f a x e H " P & & & d
#
@ @
d / ' + > . @
* -
> b
FizzBuzz
4 5 * 5 * 1 + : 0 ; > + K 3 % d
? $ K 5 % d
$ ? c
K $ K
5 : .
% : K
c ? "
$ c z
: $ z
\ : : u
b " : B
z " "
? @ z z
K u z
- B i
1 z F
\ z "
b i
F
P "
a
a
a
a