BrainfXX
Jump to navigation
Jump to search
BrainfXX is an esolang, or a family of 256 brainfuck subsets, invented by User:None1.
Commands
The name of each language is Brainf00 to BrainfFF, the last 2 characters are hex digits. When converted to binary, each digit means whether the corresponding bf command
(0th,1st,2nd,3rd,4th,5th,6th,7th digits counting from the ones digit represent whether the +-><,.[] commands are usable, respectively) is usable. For example, in Brainf01, only the + command is usable, in BrainfBF, the [ command is unusable. Unusable commands are NOPs when executed.
Equivalents to other languages
Some members in this family are equivalent to other languages on this wiki:
Interpreter in Python
By User:None1:
import sys
def bf(code,member_id): # Member ID: 2 hex digits, XX interprets BrainfXX member
s1=[]
s2=[]
matches={}
tape=[0]*1000000
k='+-><,.[]'
member_id=int(member_id,16)
for i in range(8):
if not(member_id&(1<<i)):
code=code.replace(k[i],'')
for i,j in enumerate(code):
if j=='[':
s1.append(i)
if j==']':
m=s1.pop()
matches[m]=i
matches[i]=m
cp=0
p=0
while cp<len(code):
if code[cp]=='+':
tape[p]=(tape[p]+1)%256
if code[cp]=='-':
tape[p]=(tape[p]-1)%256
if code[cp]==',':
tape[p]=ord(sys.stdin.read(1))%256
if code[cp]=='.':
print(chr(tape[p]),end='')
if code[cp]=='<':
p-=1
if code[cp]=='>':
p+=1
if code[cp]=='[':
if not tape[p]:
cp=matches[cp]
if code[cp]==']':
if tape[p]:
cp=matches[cp]
cp+=1
bf(sys.stdin.read(),'21') # Brainf21