ExampleFuck

From Esolang
Jump to navigation Jump to search

ExampleFuck is brainfuck but every command is the name of a popular problem.

It is invented by User:None1.

Commands

Command Table
ExampleFuck brainfuck
Hello World +
Cat Program -
Truth Machine >
Quine <
Polyglot ,
Self Interpreter .
FizzBuzz [
99 Bottles of Beer ]

It is case sensitive, and commands are separated with line feeds.

Example Programs

Cat Program

Hello World
FizzBuzz
Polyglot
Self Interpreter
99 Bottles of Beer

Hello World

Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
FizzBuzz
Truth Machine
Hello World
Hello World
Hello World
Hello World
FizzBuzz
Truth Machine
Hello World
Hello World
Truth Machine
Hello World
Hello World
Hello World
Truth Machine
Hello World
Hello World
Hello World
Truth Machine
Hello World
Quine
Quine
Quine
Quine
Cat Program
99 Bottles of Beer
Truth Machine
Hello World
Truth Machine
Hello World
Truth Machine
Cat Program
Truth Machine
Truth Machine
Hello World
FizzBuzz
Quine
99 Bottles of Beer
Quine
Cat Program
99 Bottles of Beer
Truth Machine
Truth Machine
Self Interpreter
Truth Machine
Cat Program
Cat Program
Cat Program
Self Interpreter
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Self Interpreter
Self Interpreter
Hello World
Hello World
Hello World
Self Interpreter
Truth Machine
Truth Machine
Self Interpreter
Quine
Cat Program
Self Interpreter
Quine
Self Interpreter
Hello World
Hello World
Hello World
Self Interpreter
Cat Program
Cat Program
Cat Program
Cat Program
Cat Program
Cat Program
Self Interpreter
Cat Program
Cat Program
Cat Program
Cat Program
Cat Program
Cat Program
Cat Program
Cat Program
Self Interpreter
Truth Machine
Truth Machine
Hello World
Self Interpreter
Truth Machine
Hello World
Hello World
Self Interpreter

XKCD Random Number

Truth Machine
Hello World
Truth Machine
Hello World
Truth Machine
Hello World
FizzBuzz
Truth Machine
Hello World
FizzBuzz
Cat Program
Quine
Hello World
Hello World
Hello World
Truth Machine
99 Bottles of Beer
Quine
Quine
99 Bottles of Beer
Truth Machine
Self Interpreter

Turing completeness

It is Turing complete since brainfuck is.

Interpreters

Python

import sys
def ef(code):
    s1=[]
    s2=[]
    matches={}
    tape=[0]*1000000
    for i,j in enumerate(code):
        if j=='FizzBuzz':
            s1.append(i)
        if j=='99 Bottles of Beer':
            m=s1.pop()
            matches[m]=i
            matches[i]=m
    cp=0
    p=0
    while cp<len(code):
        if code[cp]=='Hello World':
            tape[p]=(tape[p]+1)%256
        if code[cp]=='Cat Program':
            tape[p]=(tape[p]-1)%256
        if code[cp]=='Polyglot':
            tape[p]=ord(sys.stdin.read(1))%256
        if code[cp]=='Self Interpreter':
            print(chr(tape[p]),end='')
        if code[cp]=='Quine':
            p-=1
        if code[cp]=='Truth Machine':
            p+=1
        if code[cp]=='FizzBuzz':
            if not tape[p]:
                cp=matches[cp]
        if code[cp]=='99 Bottles of Beer':
            if tape[p]:
                cp=matches[cp]
        cp+=1
code=sys.stdin.read()
ef(code.split('\n'))