Foldy

From Esolang
Jump to navigation Jump to search

Foldy is an esolang created by squareroot12621. It's a 2D esolang, like some others, but it starts out as 1D.

Documentation

In Foldy, the code starts out as 1D. You can fold it into 2D with the { and } commands.

...That's basically the main part of Foldy. The rest of the commands are in this table:

Instruction Action
No-op
0 to 9 Push 0 to 9 to the stack
+ Add the top two values on the stack
- Subtract the top two values on the stack
* Multiply the top two values on the stack
: Integer-divide the top two values on the stack. Blows up if dividing by 0
< > ^ v Force the IP to go in a certain direction
/ \ | _ Bounce the IP
$ If the top item on the stack is greater than 0, skip the next instruction
? Replace the top of the stack with a random number in
{ If fold mode is on: Fold the rest of the code counterclockwise
If fold mode is off: Turn counterclockwise
} If fold mode is on: Fold the rest of the code clockwise
If fold mode is off: Turn clockwise
! Print the top of the stack as a character
. Print the top of the stack as a number
; Get a character from input
, Get a number from input
@ Terminate the code
& Duplicate the top of the stack
~ Pop the top of the stack
[ Move the top of the stack to the bottom
] Move the nth item on the stack to the top
# Toggle fold mode. By default, this is on

Interpreters