Jump to content
IGNORED

Brainfuck


zlemflolia

Recommended Posts

Brainfuck is the coolest programming language ever.

 

http://esoteric.sange.fi/brainfuck/impl/interp/i.html

 

There are two global variables in every Brainfuck program, a pointer to a byte and an array of 30,000 or more bytes. All values are initialized to 0 in the array

 

> increments the pointer (goes forward 1 cell in the array)

< decrements the pointer (goes backward 1 cell in the array)

+ increments the value at the pointer

- decrements the value at the pointer

[ begins a loop whose entry condition is while(*ptr>0)

] ends the loop

, reads a byte from console into the value at the pointer

. writes the value at the pointer to the console

 

Anything other than these characters is considered comments and is ignored

 

print "Hello world!" is:

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.

 

print "WATMM" is:

++++++++[>++++++++++<-]
++++++++[>>++++++++++<<-]
++++++++[>>>++++++++++<<<-]
++++++++[>>>>++++++++++<<<<-]
++++++++[>>>>>++++++++++<<<<<-]
>+++++++
>---------------
>++++
>---
>---
<<<<<
.>.>.>.>.>.
Link to comment
Share on other sites

print "SEAN PLS" is:

++++++++[>++++++++++<-]
++++++++[>>++++++++++<<-]
++++++++[>>>++++++++++<<<-]
++++++++[>>>>++++++++++<<<<-]
+++[>>>>>++++++++++<<<<<-]
++++++++[>>>>>>++++++++++<<<<<<-]
++++++++[>>>>>>>++++++++++<<<<<<<-]
++++++++[>>>>>>>>++++++++++<<<<<<<<-]
>+++
>-----------
>---------------
>--
>++
>>----
>+++
<<<<<<<<
.>.>.>.>.>.>.>.>.
Link to comment
Share on other sites

QUITE GOOD

 

++++++++[>++++++++++<-]>+.>
++++++++[>++++++++++<-]>+++++.>
+++++++[>++++++++++<-]>+++.>
++++++++[>++++++++++<-]>++++.>
+++++++[>++++++++++<-]>-.>
++++++++++++++++++++++++++++++++.>
+++++++[>++++++++++<-]>+.>
++++++++[>++++++++++<-]>-.>
++++++++[>++++++++++<-]>-.>
++++++[>++++++++++<-]>++++++++.
Link to comment
Share on other sites

I've been doing some brainfuck programming. I've also made genetic algorithms that try to optimize brainfuck code size. They generate some weird ass code.

 

This one is generated from scratch by the genetic algorithm. It writes "Hi!"

++++++[++>+>+]>-------------.<<+++++++++++++++++++.<++++++++++++++++++++++++++.

 

If I remember correctly it took about 2000 generations with population of 100 brainfuck programs in each generation to generate this. It started with totally randomly generated code and used ASCII distance and program length as scoring methods to measure fitness.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.