脑操
		
		
		
		Jump to navigation
		Jump to search
		
脑操 is a derivative of Brainfuck but in Chinese. It's created by User:None1, and it is a member of Trivial brainfuck substitution.
It is equivalent to Brainfuck.
Note: In Chinese, 脑 means "brain", and 操 means "fuck", so it gets the perfect name.
Commands
脑操 brainfuck 十 + 一 - , , 。 . 《 < 》 > ( [ ) ]
Example Programs
Cat Program
十(,。)
Hello World
十十十十十十十十(》十十十十(》十十》十十十》十十十》十《《《《一)》十》十》一》》十 (《)《一)》》。》一一一。十十十十十十十。。十十十。》》。《一。《。十十十。一 一一一一一。一一一一一一一一。》》十。》十十。
Nope. interpreter
十十十十十十(》十十十十十十十十十十十十十《一)》。》十十十十十十十十十十十(》十十十 十十十十十十十《一)》十。十。一 一一一一一一一一一一。》十十十十十(》十十十十十十十十十《一)》十。
Turing Completeness
It is Turing complete because brainfuck is.
Interpreter
Python
import sys
def nc(code):
    s1=[]
    s2=[]
    matches={}
    tape=[0]*1000000
    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
nc(sys.stdin.read())