User:HaleyHalcyon
MarioLANG test cases
The code is run on the sandbox at TIO.run.
Multiple elevators on the same X coordinate
Code
> :! "===== > ! ====# > +:! "=====
Output
0
Comments
This code tests which exit is used if multiple exits exist for the same X coordinate. Depending on which exit is taken, the number printed changes between 0 and 1.
0 is printed, because elevators prefer the exit immediately above itself.
Note to self: Remember to stop Mario before he takes the elevator.
Jump height testing
Code
>: >: > + ^ + ^ ! ===========
Output
1
Comments
In the 2D Mario games, Mario tends to be able to jump 5 grid spaces. This is a test to see how many grid spaces Mario can jump in MarioLANG.
If Mario can reach the >
, the jump height is printed. Disappointingly, this test indicates that the Mario in MarioLANG can only jump 1 grid space before he succumbs to the inexorable pull of gravity.
Wall/floor interchangeability
Code
> : : = ====||||====
Output
0 0 �[31;1mMario somehow got stuck.�[0m
Comments
This code snippet demonstrates that the blocks =
and |
only differ in aesthetics, and are functionally interchangeable.
In the middle portion, Mario walks on the floor made of wall.
In the end portion, Mario gets stuck on the wall made of floor.
Wall/floor interchangeability part 2
Code
> ==== : ! ====|==== +: ! =========
Output
0
Comments
This tests the description from the documentation that "If Mario has no ground below his feet he falls until he lands on either ground or EOF". However, this statement is false, as Mario is also stopped by the section of walls.
Cat program
Code
>, +[< "====- ! . ! #======
Input
It's-a me, Mario!
Output
It's-a me, Mario!
Comments
This is a simpler program that operates on the same design as the Truth Machine, with the looping removed.
This demonstrates that (at least in the implementation on TIO.run) if there is no character to be input, the input is treated as ÿ
, which is Character 255.
First, Mario gets a character as input, or ÿ
if there is no input left. This value is temporarily incremented to test if the input is ÿ
, in which case the <
is skipped, and Mario stops at the ledge ending in !
.
Otherwise, Mario first decrements the value back, and outputs the character with .
. Mario then returns to the top left to read the next character.