We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Braincrash

From Esolang
Jump to navigation Jump to search
Not to be confused with BrainCrash, published by ぬこ in 2008.

Braincrash is a useless programming language invented by User:TehZ, based on Brainfuck. It is made to only have 2 symbols (or you could call them commands), one of which is no-op, the other execute. It is an example of a turning tarpit.

So what is it?

Basically, it has a "command pointer" (CP, not IP), which is incremented after each command (including no-op). It points to one of the eight BF commands. It is sorted in this way:

+-><.,[]

The two commands available are " " and "!". " " is a no-op, while "!" executes the command pointed to by CP. After each step, the program increments the CP by one, and "mods" it by eight.

How am I supposed to write in this language?

You aren't, but here is a trick anyway. You start out with a file containing a line filled with "+-><.,[]" like this:

+-><.,[]+-><.,[]+-><.,[]+-><.,[]+-><.,[]+-><.,[]+-><.,[]+-><.,[](etc)

Then you add a line before that and start pressing space until you are over a BF character you want to use. When you are over one, press "!" and repeat. For example, when writing a cat program, here is the result:

     !!     !! !
+-><.,[]+-><.,[](removed)

Then you remove the second line, and you are finished.

Examples

Cat

     !!     !! !

Hello, World!

Line feeds aren't part of the program.

!     !  !       !!      !    !   !       !     ! !      !       !       !       !       ! !       !   !   !     !       ! !    
 !       !       !     !  !      !  !     !       !       !     !   !     !       ! !       !   !       !       !     !     !   
  !    !   !       !       !       !!   !       !       !   !    !       !       !       !       !       !  !      !       !    
 !  !     !       !       !       !     !   !

Implementation

This short Lua script converts braincrash into brainfuck. It treats all characters that aren't "!" as spaces, however:

io.stdin:read("*line"):gsub("()!", (function(loc) io.stdout:write(("+-><.,[]"):sub((loc-1)%8+1,(loc-1)%8+1)) end))

This is a BRB program that converts Braincrash into Brainfuck:

;!+-><.,[];{#%%[^V;@v;>%}#{?Y;®%%v;#]_

This is a Python program that converts Brainfuck into Braincrash

source = #Your code goes here
converted = ""
wheel = [">", "<", "+", "-", ".", ",", "[","]"]
i=0
x=0 
while i < len(source):
    if wheel.count(source[i])<1:
        source = source[:i]+source[i+1:]
    elif wheel[x]==source[i]:
        converted+="!"
        i+=1
    else:
        converted += " "
    x+=1
    if x >= 8:
        x -= 8
print(converted)