Brainchicken

From Esolang
Jump to navigation Jump to search

Brainchicken is a equivalent to brainfuck, created by User:None1.

Commands

Number of "chicken"'s   brainfuck
1                       >
2                       <
3                       +
4                       -
5                       .
6                       ,
7                       [
8                       ]

Example Programs

Cat Program

chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken 
chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken

Hello World

chicken chicken chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken
chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken
chicken
chicken chicken chicken
chicken chicken chicken
chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken
chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken
chicken
chicken chicken chicken
chicken chicken
chicken chicken
chicken chicken
chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken
chicken
chicken chicken chicken
chicken
chicken chicken chicken
chicken
chicken chicken chicken chicken
chicken
chicken
chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken
chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken
chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken chicken chicken chicken chicken
chicken
chicken
chicken chicken chicken chicken chicken
chicken
chicken chicken chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken chicken chicken
chicken chicken chicken chicken chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken chicken chicken
chicken
chicken
chicken chicken chicken chicken chicken
chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken chicken
chicken chicken
chicken chicken chicken chicken chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken
chicken chicken chicken chicken chicken
chicken
chicken
chicken chicken chicken
chicken chicken chicken chicken chicken
chicken
chicken chicken chicken
chicken chicken chicken
chicken chicken chicken chicken chicken

Turing Completeness

It's Turing complete because brainfuck is.

Interpreter

Python

def bf(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
fuck=''
table='><+-.,[]'
while 1:
    try:
        c=input()
    except:
        break
    fuck+=table[c.split().count('chicken')-1]
bf(fuck)