Titled
Jump to navigation
Jump to search
Titled is mostly a copy of brainfuck, however there are 2 more commands (technically making it Brainfuck+2) and one quirk.
Also there's the '
command which disables wrapping but numbers still have to be positive.
Code execution
In Titled, programs are written inside of the file's name. There are no external files; just rename the interpreter. The name (excluding the file extension) is the code to be run.
For input operations: no input = 0
Instructions
+
|
Increments the current cell by one |
-
|
Decrements the current cell by one |
)
|
Selects the cell one to the right (used parenthesis because you can't have angle brackets in the file name) |
(
|
Selects the cell one to the left |
,
|
Takes a single character input from user and stores its Unicode value in the current cell |
;
|
Does the same but with a number; sets the cell value to the number |
.
|
Outputs the current cell as a Unicode character |
'
|
Outputs the current cell as a number. (Having 65 in a cell would output 65 , not A )
|
$
|
Toggles cell overflow |
Example programs
Note: All programs listed here use the Python implementation. Also make sure to delete any newlines before renaming your implementation.
Most programs will be the same as brainfuck, but with the angle brackets replaced with parenthesis. For all the examples, add the interpreter's file extension after it.
Hello, World!
)++++++++ [)+++++++++)++++++++++++)+++++++++++++)++++++++++++++)++++++)++++)+++++++++++)++++++++++++++[(])-]) .)+++++.)++++..)-.)----.).)-.(((.+++.(.(-.))))+.
A+B Problem
$;);[(+)-]('
Implementations
Python
code = __file__.split("\\")[-1][:-3] loopStack = [] overflow = True index = 0 memory = [0] * 30000 memoryPointer = 0 while index < len(code): match code[index]: case "(": memoryPointer -= 1 case ")": memoryPointer += 1 case "+": memory[memoryPointer] += 1 if memory[memoryPointer] > 255 and overflow: memory[memoryPointer] = 0 case "-": memory[memoryPointer] -= 1 if memory[memoryPointer] < 0 and overflow: memory[memoryPointer] = 255 case ",": # input as char temp = input("input one character:\n> ").rstrip()[0] memory[memoryPointer] = temp case ";": # input as num try: temp = int(input("input a number:\n> ").strip()) except: temp = 0 memory[memoryPointer] = temp case ".": # output as char print(chr(memory[memoryPointer]), end="") case "'": # output as num print(memory[memoryPointer], end="") case "[": if memory[memoryPointer] == 0: # skip loop loopAmount = 1 while loopAmount > 0: index += 1 if code[index] == '[': loopAmount += 1 elif code[index] == ']': loopAmount -= 1 else: # enter loop loopStack.append(index) case "]": if memory[memoryPointer] != 0: # go back to to the '[' index = loopStack[-1] else: # exit loopStack.pop() case "$": overflow = not overflow index += 1