# Multidodecagony

Multidodecagony is a language made by Joaozin003 inspired by Hexagony, which is laid out in dodecahedrons. Ugh!

## Etymology

This language's name was derived from Hexagony: multi means multiple, dodeca means dodecahedrons, agony just because it's super hard to code in.

## Program layout

The program is laid out in an array of regular dodecahedrons. In each of a dodecahedron's faces, the face is separated into 5 triangles in a circle.

Each triangle contains a command, and the command pointer traverses through them.

The command pointer can go in 3 directions: clockwise in a face, counterclockwise in a face, or into the next face.

After the command pointer goes into another face, if it doesn't touch a clockwise command or a counterclockwise command, the program instantly halts, as the CP would just keep looping 1 command over and over.

There are also commands which cause the CP to warp to another dodecahedron.

Since a dodecahedron has 12 faces, with 5 commands each, one dodecahedron can hold 60 commands.

## Memory layout

The memory is just a simple stack. If you don't know what it is, here's an explanation:

Imagine a stack of papers. You can put a paper on top of it (this is called pushing), and later you can take it out to do things (this is called popping). You cannot take out things from the middle or bottom of the stack.

## Commands

Finally we can get to the commands. All commands not specified here are comments.

### CP commands

> | Makes the CP change direction to clockwise. < | Makes the CP change direction to counterclockwise. ^ | Makes the CP change direction to the face this command points to. ] | Makes the CP warp to the next dodecahedron, at this triangle. [ | The ] command, but to the previous dodecahedron. I | Pops a number n from the stack, and goes to the nth dodecahedron, at this triangle (0-indexed).

### Stack commands

0-f | Push this digit's base 16 value to the stack. p | Pop top item and discard. w | Pop x, d, f, and t from the stack. Write x to the triangle t in face f at dodecahedron d. g | Pop d, f, and t from the stack. Get character at triangle t in face f at dodecahedron d. d | Duplicate top stack item. r | Roll the top 3 stack items; same as 3R. R | Pop n, and roll the top n stack items. If stack is smaller than n items, throw error. c | Clear the stack.

### I/O commands

, | Take characters from STDIN until a valid base 10 digit is found. Then push it. Throws error if EOF is reached. ; | Take a character from STDIN and push it. Throws error if EOF is reached. . | Pop top stack item, and print it as a hexadecimal number (if you want to print as decimal, use Double Dabble). Throws error if the stack is empty. : | Pop top stack item, and print it as an Unicode character. Throws error if the stack is empty or the character is out of the Unicode domain.

### Math commands

+ | Pop a and b from the stack, add them and push the result. - | Pop a and b from the stack, subtract b from a, and push the result. * | Pop a and b from the stack, and push the product. / | Pop a and b from the stack, and push the quotient as an integer. % | Pop a and b from the stack, and push the remainder. E.g.: 5c% -> 2 | | Pop a and b from the stack, and push the quotient and remainder. Remainder goes on top. { | Multiply top stack item by 16. } | Divide top stack item by 16.

### Control flow commands

g | Pop from the stack. If item is greater than 0, go to the next face. Else go clockwise. G | Pop from the stack. If item is greater than or equal to 0, go to the next face. Else go clockwise. l | Pop from the stack. If item is less than 0, go to the next face. Else go clockwise. L | Pop from the stack. If item is less than or equal to 0, go to the next face. Else go clockwise. ) | Skip next command. ( | Pop a number n. Skip n commands. Negative n goes backwards. @ | Instantly halt the program.

## Multidodecoordinates

Did you see the w and g commands? What do d, f and t mean? These are multidodecoordinates.

The d variable is the simplest: It indicates the dth dodecahedron.

Now the t variable: t = 0 is the starting triangle. t = 1 is clockwise to that, etc.

And the most complicated variable: f.

f = 0 is the starting face. The coordinate you go to when you do ^ on f = 0, t = 0 is f = 1, t = 0.

f = 0, t = 1 goes to f = 2, t = 0 etc.

f = 1, t = 2 goes to f = 6, t = 0; f = 2, t = 2 goes to f = 7, t = 0, etc.

The coordinate you get from going from f = 6, t = 3 is f = 11, t = 0.