MazeLang
Jump to navigation
Jump to search
- This is not a Works-in-Progress. You're invited to add more examples, or more commands(if LXGW WenKai Mono GB supports and shows full-width).
MazeLang is designed by PSTF which is inspired by Befunge.
It uses ideographs instead of letters.
Plot introduction
Once upon a time, there was a boy(Mark Dreelmitex Gluzturzarzium, MDG for short), he's interested in adventure.
One day, MDG walks to a flat place. Suddenly, he floats up, and blew away by wind. He's scared, and screamed.
He lands in a maze. Now he lost in the maze, every program is a map for this maze.
Command List
+: Pop a and b, push a+b. -: Pop a and b, push b-a. *: Pop a and b, push a×b. /: Pop a and b, push the quotient of a÷b. %: Pop a and b, push the remainder of a÷b. ✗: Pop a, push 1 if a=0, otherwise 0. >: Pop a and b, push 1 if b>a, otherwise 0. →: Goes east. ←: Goes west. ↑: Goes north. ↓: Goes south. ↕: If stack-top value is 0 then goes south, otherwise goes north, and discard the stack-top value regardless with the direction. ↔: If stack-top value is 0 then goes east, otherwise goes west, and discard the stack-top value regardless with the direction. ○: Goes in random direction. ": Collect every value of character until meet next ". If meet the half-width character, only first character will detected. ¦: Duplicate stack top. ⇄: Swap the top two elements of stack. ♨: Pop top element of stack, and then discard it. I: Input number. O: Output stack-top element as number. i: Input character. o: Output stack-top element as character. ▓: A bridge. G: A "get" call (a way to retrieve data in storage). Pop two values y and x, then push the ASCII value of the character at that position in the program. If (x,y) is out of bounds, push 0. P: A "put" call (a way to store a value for later use). Pop three values y, x and v, then change the character at the position (x,y) in the program to the character with ASCII value v. If v means a half-width character, a space is automatically added, because MDG will only collect first character. ●: Sucks MDG out from the maze, thus end the program. 0123456789: Push the corresponding number onto the stack. ■: A wall, MDG will bounce back when he collide with wall. ◆: No operation. ☞: Pop s, and jump forward in this direction for s characters. MDG will appear in opposite edge if he hits any edge. ☒: Clear the stack. ♬: Pop x and y, beep with tone x and time y. X will be pop first. 60 for Center C(C4). 1 for crotchet note. ◉: Throw MDG out immediately, with top stack value as exit code. ?: Pop a and b. Turn right if a>b, turn left if b>a, do nothing if a=b. ▪: Pop all stack item and join then into string, then reverse it, then load all command from this library. ▫: Exclude all library. ▶: Turn right. ◀: Turn left.
Examples
Hello, world!
"。在好地天问"→¦▓o↔●
MDG: F*** you
→↓ ↑←
A+B
II+O●
Sieve of Erathosthenes
2→¦3G" "-✗↓⇄ G30 ← ↕✗>"O "¦+1↔¦O¦03P→03G+¦"O ">↕ ● ↑ P3⇄" "¦← 2 234567890123456789012345678901234567890123456789012345678901234567890123456789
Just simply a maze
↓ ■■■■■■■ ↓ ← ■■■■■■■ → ●