Time

From Esolang
Jump to navigation Jump to search

Time is an esolang invented by User:None1 and inspired by rand.Next(), the behavior of this esolang depends on how many times you run it.

Execution

When run, Time gets the number of times you run before this run (for example, 0 for the first run).

Then, it executes the number in Brainfoctal.

No-code esolang

Since the behavior of Time does not depend on the source code, it is a no-code esolang.

Examples

Hello World

Any text can go here

It works when current run is the 228855768768422936408264393456423041692937029376710995071693817276469283765324982920591645725406th run.

Intepreters

Stores the times run at a file called A.

def bf(code):
    s=[]
    matches={}
    tape=[0]*1000000
    for i,j in enumerate(code):
        if j=='7':
            s.append(i)
        if j=='0':
            m=s.pop()
            matches[m]=i
            matches[i]=m
    cp=0
    p=0
    while cp<len(code):
        if code[cp]=='3':
            tape[p]=(tape[p]+1)%256
        if code[cp]=='4':
            tape[p]=(tape[p]-1)%256
        if code[cp]=='6':
            c=sys.stdin.read(1)
            tape[p]=(ord(c) if c else 0)%256
        if code[cp]=='5':
            print(chr(tape[p]),end='')
        if code[cp]=='2':
            p-=1
        if code[cp]=='1':
            p+=1
        if code[cp]=='7':
            if not tape[p]:
                cp=matches[cp]
        if code[cp]=='0':
            if tape[p]:
                cp=matches[cp]
        cp+=1
try:
    a=open("A")
except FileNotFoundError:
    with open("A","x") as f:
        f.write("0")
    a=open("A")
a=int(a.read())
bf(oct('a')[2:])
open("A","w").write(int(a+1))