User:Kiken/Construction Site/Descriptions/横
This page is a draft of my esolang, 横.
横 (Chinese for horizontal) is a two-dimensional esoteric programming language made by User:kiken. It is based on so-called 'generic platformers' that are usually seen on Scratch.
Overview
The IP starts at the top-left of the grid and by default does not go in any direction. 横 also has an accumulator and a stack.
Gravity
The instruction pointer in 横 is affected by gravity (the IP will constantly fall down if possible) and collisions. The walls act like walls in reality (hence their name), and the IP can be boosted by trampolines and boosts. Objects are not affected by gravity.
Logging
The instruction pointer is able to be logged into walls: if it is somehow forced into a wall (either by boosting into a wall or spawning into a wall), it will stay there, creating an infinite loop.
Commands
A space is a NOP.
Command | Function |
---|---|
# |
Wall |
∆ |
Pass-through, like wall but IP is able to pass through the bottom |
^ |
Trampoline, boosts the IP up 4 instructions (NOP included) |
@ |
Door, acts as a wall until IP has collected key |
- |
Key, the door will become NOP when key has collected by IP |
( |
Increase the accumulator at the pointer for every instruction (NOP included) the IP goes through until ) (excluded)
|
) |
End (
|
` |
The same as ( , but with top of stack. Use this command again to end `
|
$ |
Negate the effects of ( and ` (add to subtract, subtract to add)
|
~ |
Lava, must appear in groups of at least three, kills the IP |
> |
Boost, boosts the IP one instruction right and modifies its direction (right by default) |
\ |
Flip, flips the IP's direction |
% |
Chest, pushes the accumulator onto the stack, can only be used with key (accumulator unaffected) |
° |
Keyhole, pops the top of stack, can only be used with key |
[ |
Right horizontal pipe, if the cell at pointer is 0, teleport to end of pipe (e.g. [[[[[[ )
|
] |
Left horizontal pipe, the same as right horizontal pipe but left |
+ |
Vertical pipe, the same as left horizontal pipe but up |
o |
Pop and output top of stack as ASCII. |
e |
Output top of stack as number. |
? |
Get input by character and store ASCII value in accumulator. All IPs wait at this instruction until input is given. |
¿ |
Same as ? , but numeric.
|
{ |
Initiate a clone of the IP (executes automatically). |
} |
Kill clone of IP. |
Examples
Infinite loop
>\ ##
A shorter method using logging:
#
Looping counter
e%\ ####∆ >( )-^ ######
Truth machine
\ ##∆ + %e +$( )>%e^ +###~~~ +######## + + -¿+ $( ) + ############
Cat program
- o\ ##∆ >?%^ ####
Computational class
I believe that 横 is a push-down automaton, though I have yet to prove it.
Implementations
- Python 3 implementation (unfinshed)