Ruck
Jump to navigation
Jump to search
Ruck is an esolang invented by User:None1, it has one extra command than Minimized BF: < and its tape has infinite size, making it Turing complete.
Examples
Hello World (unoptimized)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++++++++++++++++++++++++++++>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+++++++++++++++++++++++++++++++++>
Cat program
Truth Machine
This program works on the original language (Minimized BF) as well, and since non-interactive I/O is used, the program doesn't print 1 when the input is 1, instead, it runs an infinite loop which exausts infinite memory by rewriting all the cells with the ASCII values of 1, which is 49.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++[>+++++++++++++++++++++++++++++++++++++++++++++++++]
Implementations
The following Python-script is an interpreter
tape = [0]
for i in range(0, 65536): # Expand
tape.append(0)
pointer = 32768
prgm = input('>Ruck ')
init = input('>i ')
for i in range(32768, len(init)+32768): # Expand
tape[i] = ord(init[i-32768]) # Expand
# Executes the program
loop_table = {}
loop_stack = []
for ip, inst in enumerate(prgm):
if inst == "[":
loop_stack.append(ip)
elif inst == "]":
loop_beginning_index = loop_stack.pop()
loop_table[loop_beginning_index] = ip
loop_table[ip] = loop_beginning_index
inst = 0
while inst < len(prgm):
if prgm[inst] == "+":
tape[pointer] += 1
tape[pointer] %= 256
elif prgm[inst] == "<":
pointer -= 1
elif prgm[inst] == ">":
pointer += 1
elif prgm[inst] == "[":
if not tape[pointer]:
inst = loop_table[inst]
elif prgm[inst] == "]":
if tape[pointer]:
inst = loop_table[inst]
else: pass
inst += 1
pointer = 32768 # Expand
while tape[pointer]:
print(chr(tape[pointer]), end="")
pointer += 1
64K implementation, but it can be expanded.