Hexagrid
Hexagrid was designed by Emil Svensson (User:fr34k) in 2008. The name comes from how one codes in Hexagrid (hexadecimal grid).
Overview
Initially, when you code in Hexagrid, one has a virtual grid of the hexadecimal codes with pointers starting in the uppermost left corner.
v >0 1 2 3 4 5 6 7 8 9 A B C D E F
This is only for clarification, and is never shown when coding. One has to keep track of the pointer in his/her head.
By moving the pointer around one can add hexadecimal codes to different stacks.
Commands
Command | Function |
---|---|
> | Move pointer to the right |
< | Move pointer to the left |
^ | Move pointer up |
v | Move pointer down |
+ | Add to stack |
! | Clear stack and reset pointer |
o | Output stack |
x{ } | Define a stack where the stack is x |
Examples
Basics
Moving the pointer, defining a stack and adding data to it
Before we can code anything we need to define a stack that we want to work with. Remember that you can work with as many stacks as you like, the only rule is to work with the coding inside the stack limitations ({ and }). Let's call our stack myStack.
myStack{};
First of all we clear the stack and reset the pointer
myStack{!};
After that we can move the pointer using <, >, ^ and v. Let's say we want to move our pointer to A in the grid.
We move the pointer two steps to the right, then two steps down.
myStack{!>>vv};
Let us then add this data to the stack using the + command
myStack{!>>vv+}
If you want to move the pointer anywhere else, keep in mind that the pointer now points at A.
Now let's output the stack. We then use the o command
myStack{!>>vv+o};
Wich would output
A
Hello, world!
This is a Hello, World! program in Hexagrid
stack{!v+v+^>>+<+>+<<vv+^^>>+<<vv+^^>>+vv>+<^^^+<<+>v+>>+<+>vv+^^+^<+v+<<vv+^^>>+<<+^>>+<+o};
which will output
Hello World!
or in hexadecimal code
48656C6C6F20576F726C6421
Implementations
hexagrid.rb - Hexagrid interpreter in Ruby