Ruckfish
Jump to navigation
Jump to search
Ruckfish is an esoteric programming language created by User:TheCanon2. Ruckfish is a variant of Ruck and by extension a variant of brainfuck, but with syntax that resembles Deadfish.
Commands
Like Ruck, and like brainfuck, Ruckfish has an infinitely long tape of 8-bit cells. Ruckfish has 5 commands.
Command | Ruck equivalent |
---|---|
i | + |
d | > |
s | [ |
o | ] |
h | < |
Like Ruck, Ruckfish accepts an input at the beginning of a program. The EOF prints the tape as ASCII characters.
Examples
Hello, World!
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiidiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiidiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiidiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiidiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiidiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiidii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiidiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiidiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiidiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiidiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiidiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiid
Truth machine
iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii iiiiiiiiiiiiiiiiiiiiiiiiiiiisdiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiio
If the input is a 1, it will write 1 to the tape indefinitely but it will not output.
Cat
Due to the way Ruckfish handles I/O, no code is needed in order to write a cat program.
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 == "s": loop_stack.append(ip) elif inst == "o": 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] == "i": tape[pointer] += 1 tape[pointer] %= 256 elif prgm[inst] == "h": pointer -= 1 elif prgm[inst] == "d": pointer += 1 elif prgm[inst] == "s": if not tape[pointer]: inst = loop_table[inst] elif prgm[inst] == "o": 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.
The following Python script converts a program from Ruck to Ruckfish.
ruck = input('>ruck ') ruckfish = [""] for inst in range(0, len(ruck)): if ruck[inst] == "+": ruckfish.append("i") elif ruck[inst] == ">": ruckfish.append("d") elif ruck[inst] == "[": ruckfish.append("s") elif ruck[inst] == "]": ruckfish.append("o") elif ruck[inst] == "<": ruckfish.append("h") else: pass ruckfish = ''.join(ruckfish) print(ruckfish)