#[Hexagony](https://github.com/mbuettner/hexagony) Hexagony is a 2D esoteric language made by Martin Büttner based on hexagons. Not only the programs self are hexagons, but the memory model of terror is also based on hexagons. It took me quite some time to understand the model of terror, but eventually I still don't get it. First time I programmed in this, I was happy to get *anything* outputted, but after a while I realised that this is a very interesting language, with a lot to discover. I would definitely recommend programming in Hexagony. ------------ ###Length 1 snippet (try it [here][1]) ! Or in hexagon form: ! Let's talk a bit about the memory model in Hexagony. Every memory edge has a standard value, `0`. This is different from some other models, which are standard `null`. The second thing which makes this memory model different, is that the data kept in the memory edges are always numbers. No strings, lists, tuples and so on. For this program, I'm going to introduce you to the command `!`. This outputs the *decimal* representation of the current memory edge. `;` would do the same thing, but outputs the *ASCII* representation. So, you can already expect what this is going to do. This is going to print an infinite amount of `0`. **After running in the online interpreter, immediately kill it**. It won't stop, *ever*. ------------- ###Length 2 snippet (try it [here][2]) !@ Or in hexagon form: ! @ . . . . . So, you might be wondering... When can you make this stop? That is done with the `@` command. After reaching this point, the program terminates. That means we can now safely output one `0` with the program. Another thing you might be wondering is 'What are all those dots doing there?'. That brings us to the next command, the no-op `.`. When the pointer comes to a no-op, it will not do anything and continues its way in the same direction. This means that `!@` and `!@...` and `!@.....` are all the same and give the same output. However, if we add another dot: `!@......`, this would give a bigger hexagon, since the maximum amount for a two-sided hexagon is smaller than the length of the program. It would give the following: ! @ . . . . . . . . . . . . . . . . . -------------------- ###Length 3 snippet (try it [here][3]) 9!@ Or in hexagon form: 9 ! @ . . . . First of all, decimals in the program will be added to the current memory edge. If the memory egde = `402` and passes by a `3`, the new memory edge will contain `4023`. Same counts for letters, which replaces the memory edge with the ASCII value of the letter. I'll now explain how pointers move in Hexagony. But first of all, there isn't just one pointer. There are *six*. Each in every corner: 1 . 2 . . . . 6 . . . 3 . . . . 5 . 4 They all point clockwise, so `1` would go to the east (`E`), the `2` would go to the southeast (`SE`) and so on. The standard active pointer is `1`, and you can switch the active pointer using the `[` and the `]` command. The next thing is, what happens when they get out of the board? When they leave at a non-corner point, they will enter the board again in the other half of the program (pointer starts at `A`): . . . . . F . . . A . . . . A . A B C D E . . G . . . B . . F . . B . . . . . . . . A . . H . . . C . . G . . . C . . G . . . . . . . . B . . I . . . D . . H . . . . D . . H . F G H I J K . C . . J . E . . I . . . E . . I . . . . . . . D . . K . . J . . F . . J . . . . . . E . . . K . . . . K . If the pointer leaves from a corner, it depends on what value the current memory edge has (from `A` to `B`): memory > 0 memory <= 0 . . A -> . . . -> B . . . . . . . . . . . . . . -> B . . . . . . . . A -> . . . . A -> . . . . . . . . . . . . . . A -> -> B . . . . . So the order of operations in this program is `9`, `!`, `@`, which will output 9. [1]: http://hexagony.tryitonline.net/#code=IQ&input= [2]: http://hexagony.tryitonline.net/#code=IUA&input= [3]: http://hexagony.tryitonline.net/#code=OSFA&input=