How dare you fuck the brain

From Esolang
Jump to navigation Jump to search

How dare you fuck the brain is a brainfuck esolang made by User:Ractangle

Syntax

Command Meaning
I Increment current cell
D Decrement current cell
^ Move the cell pointer right
v Move the cell pointer left
) Go back to the beginning of the line where the ) is currently at if the current cell is not 0
P Print a character from the cell's value
N Print the cell's value
= Copy the current cell's value to the cell next to it
+ Sum the current cell's value and the cell next to it and put the result to the first cell of the operator and empty the cell next to it
# Moves to the next line. Can be used for comments
H Halts program
/ Skips a command if the cell pointer is not zero
Sets the the claw to the cell's value
Sets the cell's value to the claw

Examples

Disan Count (kinda)

IIIII # This is the input
ND) # Decrements from input to zero
H

Truth-machine

# add an I for 1 or keep it empty for 0
N/H)

An alternative version:

# add an I for 1 or keep it empty for 0
N)
H

Erase data in a cell

D)

Hello, world!

II=+=+=+=+=+IIIIIIIIP= # h
DDDP # e
^IIIIPP # l
IIIP # o
^II=+=+=+=+^II=+=+=+DDDDv+P # ,
D)v
D)II=+=+=+=+P # space
=+^II=+=+=+v+IIIIIIIP=^=v # w
D^Dv)II=+=+=+DDDDDDv+P= # o
IIIP # r
^DDDP # l
^DD=+=+v+P # d
D)II=+=+=+=+IP # !
H

Move data from a cell to an another cell

= # Copy from the other cell before erasing the data from it
D)

Using the claw:

↑ #some value from the other cell
^^^ #you can move the value basicly anywhere
↓ #the claw will replace the current cotent of the cell that the pointer is currently pointing at and replcade it with the value from the grabed cell

A+B Problem

IIIII # Input 1
^IIIII # Input 2
vI^D)vN
H

computational class

HDYFTB is Turing-complete since Brainfuck can be translated into HDYFTB

[...] -> \n...) yes the \n is a newline
+ -> I
- -> D
> -> ^
< -> v
. -> P

Interpreter

Xyzzy made a python interpreter of HDYFTB. Modified by User: Ractangle

tape=[0]*256
code="""
IIIII # Input 1
^IIIII # Input 2
vI^D)vN
H
"""
cp=0;
dp=0;
c=""
while(True):
  if(code[cp]=="I"):
    tape[dp]+=1
  elif(code[cp]=="D"):
    tape[dp]-=1
  elif(code[cp]=="^"):
    dp+=1
  elif(code[cp]=="v"):
    dp-=1
  elif(code[cp]=="P"):
    print(chr(tape[dp]),end="")
  elif code[cp]=="N":
    print(tape[dp],end="")
  elif code[cp]=="=":
    tape[dp+1]=tape[dp]
  elif code[cp]=="+":
   p=tape[dp+1]+tape[dp];tape[dp]=p;tape[dp+1]=0
  elif code[cp]=="#":
    while code[cp]!="\n" :
      cp+=1
  elif code[cp]==")":
    if(tape[dp]!=0):
      while(code[cp]!="\n"):
        cp-=1
  elif code[cp]=="/":
    if(tape[dp]!=0):
      cp+=1
  elif code[cp]=="↑":
    if c!="":
      print("claw aready defined");break
    c=tape[dp]
    tape[dp]=0
  elif code[cp]=="↓":
    if c=="":
      print("claw undefined");break
    tape[dp]=c
    c=""
  elif code[cp]=="H":
      break
  cp+=1