SMG4: Mario Gets His PINGAS Stuck In The Door

From Esolang
Jump to navigation Jump to search

This is 2D a programming language based on SMG4's video SMG4: Mario Gets His PINGAS Stuck In The Door, hence its name. It was created by User:LEOMOK and inspired by Ly, Funge-98 and Toddler. The instruction pointers have to try their luck on not getting their pingases stuck in doors (conditional instructions), which make them crazy and start adding random values to anything pushed to their stack.

It uses an infinite list of 2d grids, also called 'floors', seperated by @@@ (imagine the building the video was set in).

Each IP has its own stack of 64-bit IEEE floating point values.. It also has a global stack to store values.

There can be any number of IPs, including SMG4, a special IP which starts in a random position, moves randomly and ignores all instructions except walls. When it reaches a door, it frees everyone whoes pingases are stuck in it.

Every floot is automatically surrounded with walls.

When an IP reaches a door, it gets a 1 in (number of non-door instructions in the source code + 1) chance to get its pingas stuck in it. When an IP gets its pingas stuck in a door, 'MY PPPIIINNNGGGAAASSS' is printed to stderr, it will not move until it gets freed, and after that it will start to go crazy by adding a random amount between 0.05 and 2 to each value pushed to its stack (doubles every time it happens, so the second time it will add 0.1 to 4, and so on.). The only way to get it back to normal again is to push an integer value on the stack (easier said than done, since it would be going crazy).

Instructions

First of all, use the S command to initaialize an IP

By the way, when I say 'the stack', I mean the local stack owned by the current IP.

Instruction Meaning
< > ^ V Change direction to left/right/up/down, respectively.
Y Random direction.
W Walls. Do not let anything pass through.
D Doors. Open if top value == 0 (no pop), closed otherwise.
J Jump. Pop v, w, jump to (v, w) in the codebox without changing direction.
# Skip the next instruction.
0-9 Push that number onto the stack.
() Number scanning. Push everything between the parens as a number (e.g. -123.45e+67)
' Push the Unicode> of the next character.
" Push the Unicode> of everything between the quotes, reversed for asy printing.
+ - * / % $ & | ~ X Pop v, w, push w op v ($ is power, the last four are bitwise and, or, not and xor.).
s Pop v, push sqrt(v).
! Pop v, push 1 if v==0, 0 otherwise.
? Pop v, w, push random number between v and w.
M Pop v, w, push math function w of v (see Math functions)
E ] [ Equals, greater and less. Pop v, w, push 1 if w op v, 0 otherwise.
i Pop v, push v+1.
d Pop v, push v-1.
n Pop v, push ASCII representation of v, null terminated (128 -- 49 50 56 0)
N Pop until a non-numeric character is reached, then push popped values as number (49 50 56 0 -- 128).
= Duplicate.
_ Pop.
\ Swap.
{ Move bottom value up.
} Move top value down.
R Reverse the stack.
L Push length of stack.
O Over. Pop v, dup the vth (zero indexed) stack item.
` Toggles popping mode. If off, doesn't pop values from the stack.
: Print top of stack and pop.
. Print top of stack as Unicode> and pop.
; Input arithmetic expresion using +, -, *, /, %, **, brackets and math functions then push result.
, Input character then push Unicode> on stack.
G Get. Pop v, w, push value at (v, w).
e Exit door. Once passed, becomes locked forever.
P Put. Pop v, w, x, set value at (v, w) to x.
F Push the number of the current floor (zero indexed starting from bottom)
Q Go one floor up at (0,0) (if possible)
q Go one down up at (0,0) (if possible)
Z Pop and push to global stack.
z Pop from global stack and push.
@+ Pop the whole stack and push the sum.
@* Pop the whole stack and push the product.
@. Pop the whole stack and print as string.
@_ Clear or empty the stack.

When the character with Unicode value 0 is printed, the program ends.

Math functions

Here are the math functions that can be done using the M command. Depending on the first popped stack value, they are:

  1. sin
  2. asin
  3. cos
  4. acos
  5. tan
  6. atan
  7. sinh
  8. asinh
  9. cosh
  10. acosh
  11. tanh
  12. atanh
  13. ln
  14. log_10
  15. e^
  16. sign
  17. abs
  18. floor
  19. ceil

Examples

Hello World

   S"Hello World"@.0.