Mazerunner

Mazerunner is an esolang made by User:Error 27 in 2023. It was made based on the left-hand rule for solving mazes, where a rat traverses the program by always turning left when given the option. Programs are in the form of paths from a start to a goal, and the rat executes instructions as it passes them on the way to the goal. During the program the rat must also be regularly fed in order to keep it alive.
== Language overview ==
Mazerunner programs are on a 2-dimensional grid and form a path from the start to the goal. A rat starts facing north on the start and traverses the path by turning left whenever possible, until it reaches the goal. As the rat passes over an instruction, that instruction is executed. The rat must be fed every 10 steps or it dies, but will also die if overfed. Overfeeding happens when the rat eats 3 pieces of food with less than 4 steps between each. Data is stored in the stack and accumulators A and B. All data values are 8-bit unsigned integers and only count from 0 to 255.
=== Instruction set ===
Instruction	Description
+ 	Empty path that does not execute an instruction
S 	Program starting point
c 	Cheese that feeds the rat
C 	Goal that ends the program when reached
a 	Add 1 to accumulator A
b 	Add 1 to accumulator B
A 	Subtract 1 from accumulator A
B 	Subtract 1 from accumulator B
z 	Set accumulator A to 0
Z 	Set accumulator B to 0
T 	Stop the rat from moving left if accumulator B is not 0
Y 	Stop the rat from moving left if accumulators A and B are not equal
P 	Push accumulator A to the stack
p 	Pop from the stack and output as a number
r 	Pop from the stack and output as a character
R 	Pop the whole stack and output as a string
o 	Pop from the stack and copy to accumulator A
O 	Pop from the stack and copy to accumulator B
d 	Pop from the stack and discard the value
i 	Take in input and push each character to the stack
^ 	The rat cannot reach this instruction from the north
> 	The rat cannot reach this instruction from the east
< 	The rat cannot reach this instruction from the west
v 	The rat cannot reach this instruction from the south
Inaccessible text can be considered a comment, although using S in these comments can cause a start position to be selected in the comment.
== Code examples ==
=== Hello World! ===
Prints "HELLO WORLD!" by adding ASCII values to the stack and outputting all of them at the end.
 A
 c
 A
 A
 A
 ++++c++++c+++P+
 + caaaPRC
 +c++PPAAA+Pc+
 A
 bbbcbbbbbc>+Tacaaaaa
 z + c
 + +c++Baaaa
 +
 c++++++c+++++++c+++++PAcA
 A
 cbbbbb+c>+Tacaaaa+
 c z + +
 c a + c++++Bcaa
 a a +
 a a +
 a a +
 aPc++PAcAAP++Pc
 a
 caaaaaaP+ac
 a
 cbbbbbbc>+Tacaaaaa
 + + c
 + + caBaaaa
 +
 +c++++++z+Pc+
 +
 Sbbb+++++c>+Tacaaaaa
 + c
 +c+Baaaaa
Another, more compact example by User:BrainFuckGirl printing "Hello, world!" using the same method, but with a comma and capitalization.
 PcAAAPPcAPTc<OzP caa
 b A A A Ba A a a
 b PRC a AAA PAT a
 b>AAcT c Paa B a
 B+AAAAc a ^ 
 aaaca b
 PPzO a bcz
 b c B>ca aaacaP b P
 b>BTc BTaP P AA a
 b + a a a a P a a
 S aaaaaac caaaa acaaa
=== Cat ===
Write the input to the output.
 S>ciR+
 ++++
Example by User:BrainFuckGirl that actually terminates after completing.
 SiRC
=== Truth machine ===
Take in input. If the input is 1, output 1 and end the program. Else, output 0 forever.
 rC
 P
 iORcY+Ac>Pr++
 + +++c
 c
 Sbbbbbbb+c>+Tacaaaaa
 + c
 +c+B++++a
More compact version
 b CrPYA>cP+
 b O ++r
 b i
 Sbbc>BTacaaa
=== Decimal Input ===
This program takes an input up to 255 and converts it to a single number on the stack (string to byte conversion). This is useful as a starting point for programs that need an input from the user to work. It could be adapted to take multiple numbers by separating them with a 0 before taking another input.
 pC
 S P ca+
 i c >B+T>+cAA
 >OTPz O A
 ++ aaca + A
 c >aaa +B + A
 A c T+<+ A
 A ++++c+ A
 A AAA A
 AAAAAcAAA AAc
=== Disan Count ===
Implementing the Disan Count using the example from above. This takes an input number from 1-255 and then outputs all even numbers from 0 to the chosen number.
 C C
 pT>caYa
 P +pPYPpC
 Oz
 S P ca+
 i c >B+T>+cAA
 >OTPz O A
 ++ aaca + A
 c >aaa +B + A
 A c T+<+ A
 A ++++c+ A
 A AAA A
 AAAAAcAAA AAc
== External resources ==
* Original interpreter on GitHub
Category:LanguagesCategory:ImplementedCategory:Two-dimensional languagesCategory:Stack-basedCategory:2023Category:Unknown computational class