Seas

From Esolang
Jump to navigation Jump to search

Seas is a 2D esoteric programming language made by User:AmNow and was made for TeamSeas.

Commands

The memory field is an infinite sea with the instruction pointer at 0,0 and moves rightward.

🌊🌊🌊🌊
πŸ”³πŸŸ¦πŸŸ¦πŸŸ¦
🟦🟦🟦🟦

Everything outside of a written program is initialized with a space or a random character from the printable ASCII range with a β…• chance. Program execution ends when the instruction pointer reaches the top of the sea. Every line must be the length of the first one. The first line can only have 🌊 (whitespace not allowed).

Command Effect
🟦 NOP.
🌊 Ends the program, this can only be at the first line.
0️⃣ through 9️⃣ Push the corresponding digit to the stack.
πŸ…ΏοΈ Pop the top two values on the stack and locate the coordinates in the sea and swap it with the accumulator.
🧾 Swap the top of the stack with the accumulator.
🌑 Set the accumulator to 0.
πŸ”‘ Clear the entire stack.
πŸ– Reverse the stack.
πŸ“— Move the bottom-most element up to the top.
πŸ“™ Move the top element to the bottom.
πŸ–‹ Reflects the instruction pointer's direction on an ascending mirror: The following conversion apply from the current to the new direction: leftdown, rightup, upright, downleft.
βœ’οΈ Reflects the instruction pointer's direction on an descending mirror: The following conversion apply from the current to the new direction: leftup, rightdown, upleft, downright.
πŸ“ Pop the top value of the stack, if it is 0, move up, otherwise move down.
πŸ“ Pop the top value of the stack, if it is 0, move left, otherwise move right.
βž• Pops the top element, a, from the stack, removes the new top element, b, and pushes the sum of a + b onto the stack.
βž– Pops the top element, a, from the stack, removes the new top element, b, and pushes the different of a - b onto the stack.
βœ–οΈ Pops the top element, a, from the stack, removes the new top element, b, and pushes the product of a * b onto the stack.
βž— Pops the top element, a, from the stack, removes the new top element, b, and pushes the quotient of a - b, truncated to its integral tmema only, onto the stack.
πŸ”ΌπŸ”½β—€οΈβ–ΆοΈ Rotate the instruction pointer to match which way it is facing.
πŸ’‘ Input a number and push it.
πŸ“– Input a Unicode Character and push it.
πŸ—³ Pop the top value and output as a number.
πŸ“… Pop the top value and output as a Unicode Character.
βœ‰οΈ Pop and discard.
βœ‚οΈ Swap.
🧻 Duplicate.
πŸ₯€ Logical NOT the top of the stack.

Programs

Truth-Machine

🌊🌊🌊🌊🌊🌊🌊
πŸ’‘πŸ”½πŸ—³πŸŸ¦πŸŸ¦πŸŸ¦πŸŸ¦
🟦🟦0οΈβƒ£πŸŸ¦πŸŸ¦πŸŸ¦πŸŸ¦
πŸŸ¦β–ΆοΈπŸ“πŸŸ¦πŸŸ¦πŸŸ¦πŸŸ¦
πŸŸ¦πŸŸ¦β–ΆοΈ1οΈβƒ£πŸ—³1️⃣◀️

Cat Program

A character-based cat program, which operates in an olamic fashion, shall be adduced below:

🌊🌊🌊🌊
β–ΆοΈπŸ“–πŸ“…πŸ”½
πŸ”ΌπŸŸ¦πŸŸ¦β—€οΈ

Computational class

Seas can be proven to be Turing-complete by reduction from Reversible StackBit with only 10 instructions and no accumulator (arrows could be replaced by mirrors reducing it by 2 but for simplicity arrows will be used): 🌊🟦0️⃣1οΈβƒ£πŸ“πŸ–πŸ”½πŸ”ΌπŸ”½β—€οΈβ–ΆοΈ

0 is:

🌊
0️⃣
🟦
🟦

1 is:

🌊
1️⃣
🟦
🟦

~ is:

🌊
πŸ–
🟦
🟦

* is:

🌊🌊🌊
πŸ”½β–ΆοΈβ–ΆοΈ
β–ΆοΈπŸ“πŸŸ¦
πŸŸ¦β–ΆοΈπŸ”Ό
🟦🟦🟦

[abc] is:

🌊🌊🌊...🌊🌊🌊
πŸ”½β–ΆοΈβ–ΆοΈabcπŸ”½β–ΆοΈβ–ΆοΈ
β–ΆοΈπŸ“πŸŸ¦...β–ΆοΈπŸ“πŸŸ¦
πŸŸ¦β–ΆοΈπŸŸ¦...πŸŸ¦πŸŸ¦πŸ”Ό
πŸŸ¦πŸŸ¦πŸ”Ό...πŸŸ¦β—€οΈπŸŸ¦

There should be n amount of empty lines between  third and fourth lines based on amount of nested loop times 2 inside, each time a nested loop occurs this amount is reduced by two.

Interpreter

  • Common Lisp implementation of the Seas programming language. Please note that the concrete character set deployed constitutes a dependency on the Common Lisp implementation; in corollary, Unicode support may or may not be a feature incorporated in the personal environment. The interpreter at hand has been developed and tested with Steel Bank Common Lisp (SBCL) version 1.1.4 as part of the Lisp Cabinet 0.3.5 bundle.