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.

Ralative 1 Bit

From Esolang
Jump to navigation Jump to search

Ralative 1 Bit is a variant of 1 Bit, a quarter byte made by user:Krolkrol that has unbounded memory.

Instructions

The instructions stay relativly unchanged from the original, the only difference is that '1' inverts the next bit instead of the other one which allows for unbounded memory.

Examples

Binary Hello, World! + Quine

01001000011001010110110001101100011011110010110000100000010101110110111101110010011011000110010000100001

Implementation

def interpret(code):
    cp = 0
    code = list(code)
    while True:
        if code[cp] == '0':
            return "".join(code)
        elif code[cp] == '1':
            if cp < len(code) - 1:
                if code[cp+1] == '0':
                    code[cp+1] = '1'
                else:
                    code[cp + 1] = '0'
            else:
                if code[0] == '0':
                    code[0] = '1'
                else:
                    code[0] = '0'
                
        if cp < len(code) - 1:
            cp += 1
        else:
            cp = 0