Ratsize
Ratsize is a queue-based 2D esoteric programming language created by User:Zero player rodent.
Details
In Ratsize, the IP starts in the bottom right of the program, (index [-1][-1] on the 2D array of commands) and moves upward. The IP cannot freely move left, right, or down, but it can branch off onto different paths. Ratsize uses a single queue for memory. The queue stores unbounded negative or positive integers.
Commands
| Command | Outcome |
|---|---|
~ |
Enqueue the following integer with value 0-9. |
} |
Enqueue the value in queue. |
{ |
Dequeue. |
+ |
Increment the value in queue. |
- |
Decrement the value in queue. |
Y |
Branch left if value in the front of the queue is 0, else branch right. |
y |
Branch left if value in the rear of the queue is 0, else branch right. |
v |
Jump to last ^ the IP pointed to.
|
! |
Output integer in queue. |
* |
Output ASCII character associated with integer in queue. |
= |
Enqueue byte of input. If there is no input, enqueue 0. |
P |
Output queue. |
_ |
Terminate program. |
Computational class
Ratsize is Turing complete, because you can translate any minimized Brainpocalypse program into it. To translate a minimized Brainpocalypse program to Ratsize, first you must enqueue 256 zeroes. Directly after initializing the queue, insert a ^ after it. Then change each Brainpocalypse command into its Ratsize equivalent.
| Minimized Brainpocalypse command | Corresponding Ratsize code |
|---|---|
} |
+
{
}
|
- |
v - Y |
(Note that you must place all following code after a - equivalent in the path that branches right.)
Example program
v
!
^
+ _
Y
_ -
! |
Y
| v
| {
| }
| -
| -
- -
- -
- -
- -
- -
- -
- -
- -
{ {
} }
Y
-
^
+
+
+
+
+
{
}
0
~
=