We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

36

From Esolang
Jump to navigation Jump to search

36 is an esolang made by User:Marcus 2n2.

Info

Rules

36 has a two sided tape, each cell wraps on 36 (35 + 1 = 0, 0 - 1 = 35). The number to alphanumeric/symbol conversion goes:

0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
(!@#$%^&*)abcdefghijklmnopqrstuvwxyz
 .,:;?=_/|\~©[]{}"'+-<>Ññ×÷®√™π`¶≤≥≠

Where 0 = 0 and 35 = Z

Syntax

Symbol What they do
0 Reset current cell.
5 Multiply current cell by 5.
7 Multiply current cell by 7.
A Output current cell as uppercase alphanumeric.
a Output current cell as lowercase alphanumeric.
! Output current cell as symbol.
? Ask user input.
[ Work the same as in Branflakes.
]
>
<
+

Examples

Hello, World!

+555A5+a+57aa+++a++7!0!+557+A++7++a+++a+5+5a++57a0+a

Implementations

Python

def run36(code: str, inp: str = ""):
    import collections
    tape = collections.defaultdict(int)
    p = 0
    ip = 0
    inpoint = 0
    output = ""
    open_brackets = []
    close_brackets = []
    for index, char in enumerate(code):
        if char == "[":
            open_brackets.append(index)
        elif char == "]":
            close_brackets.append(index)
    open_brackets.reverse()
    forward_jumps = dict(zip(open_brackets, close_brackets))
    backward_jumps = dict(zip(close_brackets, open_brackets))
    jump_table = {**forward_jumps, **backward_jumps}
    while ip < len(code):
        tape[p] = tape[p]%36
        if code[ip] == "+":
            tape[p] += 1
        if code[ip] in "025":
            tape[p] *= int(code[ip])
        if code[ip] in "><":
            p += {">": 1, "<": -1}[code[ip]]
        if code[ip] in "Aa!":
            char_sets = {
                "A": "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",
                "a": "(!@#$%^&*)abcdefghijklmnopqrstuvwxyz",
                "!": " .,:;?=_/|\~©[]{}\"'+-<>Ññ×÷®√™π`¶≤≥≠"
            }
            current_set = char_sets[code[ip]]
            output += current_set[tape[p]]
        if code[ip] == "?":
            if inpoint < len(inp):
                try:tape[p]="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".index(inp[inpoint]);tape[p+1]=1
                except:
                    try:
                        tape[p]="(!@#$%^&*)abcdefghijklmnopqrstuvwxyz".index(inp[inpoint])
                        tape[p+1]=2
                    except:
                        try:
                            tape[p]=" .,:;?=_/|\~©[]{}\"'+-<>Ññ×÷®√™π`¶≤≥≠".index(inp[inpoint])
                            tape[p+1]=0
                        except:
                            tape[p]=0;tape[p+1]=35
                inpoint += 1
            else:
                tape[p+1]=0;tape[p]=0
        if code[ip] == "[" and not tape[p]:
            ip = jump_table[ip]
        if code[ip] == "]" and tape[p]:
            ip = jump_table[ip]
        ip += 1
    return output
print(run36("code here"))