How dare you fuck the brain

From Esolang
Jump to navigation Jump to search
Official logo

How dare you fuck the brain is "brainfuck but it's only purpose to be a golf esolang"-like esolang, created by User:Ractangle and is by far the best thing he has made (excluding the unimplemented languages)

Syntax

Command Meaning
I Increment current cell
D Decrement current cell
^ Move the cell pointer right
v Move the cell pointer left
) Go to the nearest last newline if the 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 of and the cell next to it and put the result to the first cell of the operator and empty the cell next to it
H Halts program
/ Skips a command if the cell is not zero
Sets the the claw to the cell's value
Sets the cell's value to the claw
G Goto statement. Does nothing if the current cell is negative
; Gets user input and stores the interger into the currently pointing cell
-> Comment. Ignores all characters until encounters a newline

Examples

Disan Count

;
D^INv)H

Truth-machine

;/N/H^I
N)

Erase data in a cell

D)

Hello, world!

IIII=+=+=+=+IIIIIIIIP=DDDP^IIIIPPIIIP^IIII=+=+=+^IIII=+=+DDDDv+P
DvD^)IIII=+=+=+P=+^IIII=+=+v+IIIIIIIP=
vD^D)^DDDDDDDDv+P=IIIP^DDDP^DDDD=+v+P^IIII=+=+=+IPH

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

;=;+NH

computational class

HDYFTB is Turing-complete since Brainfuck can be translated into HDYFTB (proof by User:Yayimhere)

[...] -> \n...) or |...)
+ -> I
- -> D
> -> ^
< -> v
. -> P

Are nesting loops suported in HDYFTB... No

Interpreter

Xyzzy made a python interpreter of HDYFTB, modified majorly by User: Ractangle.

from sys import argv
debug=imp=cp=dp=0;a=argv[1:]
while a:
  if a[0]=="-d":debug=1
  elif a[0]=="-c":imp=1
  a.pop(0)
tape=[0]*8;code="""H""".strip();c=""
while cp!=len(code):
  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]=="+":tape[dp]=tape[dp+1]+tape[dp];tape[dp+1]=0
  elif code[cp]==")":
    if tape[dp]!=0:
      while code[cp]not in"\n|":cp-=1
  elif code[cp]=="/":cp+=1 if tape[dp]!=0 else 0
  elif code[cp]=="↑":
    if c!="":print("claw aready defined");break
    c=tape[dp];tape[dp]=0
  elif code[cp]=="↓":
    if c=="":print("claw undefined");exit()
    tape[dp]=c;c=""
  elif code[cp]=="H":break
  elif code[cp]=="G": cp=tape[dp]if tape[dp]>0 else cp
  elif code[cp]==";":
      try:tape[dp]=int(input())
      except EOFError:print("EOF reached",end="");exit()
  elif code[cp:cp+2]=="->":
    try:cp=code.index("\n",cp)
    except ValueError:break
  cp+=1
print(chr(tape[dp])if imp else tape[dp])
if debug:print(f"\n{tape}\npointing at {dp+1}")