The Past

From Esolang
Jump to navigation Jump to search

The Past is a time-traveling esolang by User:PythonshellDebugwindow.

Memory model

The Past uses an arbitrary-size signed integer accumulator.

Output

The final value of the accumulator is output (if the program goes into an infinite loop, then nothing will be output).

Commands

Command Effect
+ Increment the accumulator
- Decrement the accumulator
. Wait a tenth of a second
< Go back one millisecond in the past

Implementation

Written in Python 3. This implementation assumes a single unchanging timeline. Therefore, there are no paradoxes. It is not guaranteed to be correct in a mutable timeline or a branching multiverse.

program = '''Insert program here'''

def value(command):
    if command == '+':
        return 1
    elif command == '-':
        return -1
    else:
        return 0
print(sum(map(value, program)))