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.
QuineFuck
Jump to navigation
Jump to search
QuineFuck is an esolang invented by User:None1.
Syntax
QuineFuck is brainfuck, but every character that is ignored in brainfuck prints itself
Example Programs
Cat
,[.,]
Hello World
Hello World!
Quine
Quine
Quine 2
Fuck!
Interpreter
Adapted from a normal brainfuck interpreter by 5anz (talk) with the goal of typing it in python without arrays.
That's also why the exec() function is everywhere
def cell(n):
if n >= 0:
return "cell" + str(n)
else:
return "cell_" + str(-n)
print("Please enter brainfuck code")
code = input()
stack = 0
inp = False
for char in range(len(code)):
if code[char] == "[":
stack += 1
exec("stack" + str(stack) + " = " + str(char))
elif code[char] == "]":
exec("past = stack" + str(stack))
stack -= 1
exec("char" + str(past) + " = " + str(char))
exec("char" + str(char) + " = " + str(past))
elif code[char] == ",":
inp = True
if inp:
print("Please enter the input to said brainfuck code")
inp = input()
print("==========================================================================")
ip = 0
inpp = 0
ap = 0
cell0 = 0
cellMin = -1
cellMax = 1
while ip < len(code):
func = code[ip]
if func == "+":
exec(cell(ap) + " = (" + cell(ap) + " + 1) % 256")
elif func == "-":
exec(cell(ap) + " = (" + cell(ap) + " - 1) % 256")
elif func == "<":
ap -= 1
if ap == cellMin:
exec(cell(ap) + " = 0")
cellMin -= 1
elif func == ">":
ap += 1
if ap == cellMax:
exec(cell(ap) + " = 0")
cellMax += 1
elif func == ".":
exec("print(chr(" + cell(ap) + "), end = )")
elif func == ",":
if inpp == len(inp):
exec(cell(ap) + " = 0")
else:
exec(cell(ap) + " = ord(inp[inpp])")
inpp += 1
elif func == "[":
exec("if " + cell(ap) + " == 0: ip = char" + str(ip))
elif func == "]":
exec("if " + cell(ap) + " != 0: ip = char" + str(ip))
else:
print(func, end = "")
ip += 1