ETC

From Esolang
Jump to navigation Jump to search
This article is not detailed enough and needs to be expanded. Please help us by adding some more information.

ETC, standing for both "etc." and ETC, is a minimalist esolang, created by user:Elbereth, with only 3 commands excluding NOP: E, T, C.

E 

means increment counter by 1;

T 

means multiply counter by 2;

C 

means jump to command with position same as the counter. However, if the counter points to the same location, to prevent an infinite loop, it acts as E but also prints the ASCII/Unicode character represented by value of the counter.

All other characters are NOP; The standard form is .

Note the counter increments are done modulo the program size, which means that infinite loops are still possible and very easy to make, for example:

CCCTC

Computational class

ETC could be Turing-complete, though not proven yet.

etc.py

program = input('Program: ').upper()
index = 0
counter = 0
while index < len(program):
    if program[index] == 'E':
        counter += 1
    elif program[index] == 'T':
        counter *= 2
    elif program[index] == 'C':
        if index == counter:
            print(chr(index), end="")
            counter += 1
        else:
            index = counter - 1
    index %= len(program)
    counter %= len(program)
    index += 1