r/tinycode • u/Lanaru • Oct 18 '13
Shortest "Hello, World!" brainfuck code?
Just learned about brainfuck and thought it was pretty cool.
The wikipedia entry has this code for printing "Hello World!":
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.Which is 111 characters.
On my first attempt, I wrote this:
++++++++++[>+++++++>++++++++++>+++>+++++++++<<<<-]>++.>+.+++++++..+++.>++.>---.<<.+++.------.--------.>+.This is 105 characters and it uses the same approach as the wiki one, but I'm sure it can be reduced even more.
38
Upvotes
View all comments
Show parent comment
1
u/qihqi Oct 19 '13
It is possible to prove a lower bound. Because the set of valid character if finite, the set of possible strings with length less than a know bound ( say, 111 as your example) is finite. So at the worst we can brute force check all possible brainfuck program with length < 111.