BitSwitch
Jump to navigation
Jump to search
BitSwitch is an esolang made by User:Bloodyknucles.
Designed by | User:Bloodyknucles |
---|---|
Appeared in | 2020 |
Memory system | none |
Dimensions | one-dimensional |
Computational class | Total |
Major implementations | See #Interpreter in Python 3 |
Dialects | none |
File extension(s) | only shell version |
Commands
Here is a table of the commands in BitSwitch:
Name | Function |
---|---|
0-1 | Outputs the other digit |
b | Outputs Itself (Requires Immediately Previous Binary Digit) |
Interpreter in Python 3
import sys while True: cmd = input("bitswitch > ") for i in range(len(cmd)): if cmd[i] in "01": print(end="0" if cmd[i] == "1" else "1") elif cmd[i] == "b": if i > 0 and cmd[i - 1] in "01": print(end="b") else: print("Syntax error: `b` without previous binary digit") sys.exit(1) else: print(f"Syntax error: invalid character `{cmd[i]}`") sys.exit(1) print()