Symbolmathing

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.

Symbolmathing is esolang by beginner at the esolangs — User:bebebe (Do not take this as real name!! It's a nickname.) bebebe's task was to make esolang for unusual work with mathematics - without letters and numbers: only symbols! Symbolmathing is parsing character-by-character.

Commands

+

+ is add 1 to current number

-

- is subtract 1 to current number

=

= is print current number

^

^ ceiling current number

_

_ flooring current number

/

/ subtract the half of current number

?

? is adding random number to current number (1-10)

.

. is waiting for current number

Interpreter

Here 2 interpreters:

Python Interpreter

import time
import random
import math
n=0
print("-Welcome to the Symbolmathng interpreter!")
print("-Enter your code below.")
code=input("code:")
for ch in code:
    if ch=="=":print(n)
    if ch=="+":n+=1
    if ch=="-":n-=1
    if ch=="^":n=math.ceil(n)
    if ch=="_":n=math.floor(n)
    if ch=="/":n=n/2
    if ch=="?":n+=random.randint(1,10)
    if ch==".":
        try:
            time.sleep(n)
        except Exception:
            pass
            

JS interpreter

(async () => {
    let n = 0;
    console.log("-Welcome to the Symbolmathng interpreter!");
    console.log("-Enter your code below.");
    const code = prompt("code:");
    
    function sleep(seconds) {
        const t = Math.min(Math.max(seconds, 0), 10) * 1000;
        return new Promise(resolve => setTimeout(resolve, t));
    }
    
    for (const ch of code) {
        if (ch === "=") console.log(n);
        if (ch === "+") n += 1;
        if (ch === "-") n -= 1;
        if (ch === "^") n = Math.ceil(n);
        if (ch === "_") n = Math.floor(n);
        if (ch === "/") n = n / 2;
        if (ch === "?") n += Math.floor(Math.random() * 10) + 1;
        if (ch === ".") {
            try {
                await sleep(n);
            } catch (e) {}
        }
    }
})();

Examples

3, 2, 1

+++=-=-=-
This example is created by Bebebe

3, 2, 1 without the extra part "-" at the end

+++=-=-=
This example is created by Digitpink

Links

Talk: Symbolmathing — Symbolmathing's chat