Alternative Versions

Comments

PuppE said on 05/18/05 00:07:20

o.O very "special" ...

Rune Berge said on 05/29/05 11:58:46

Unfortunately it says "1 bottles" and it has an extra verse which doesn't really belong in the song:
00 bottles of beer on the wall
00 bottles of beer
take one down and pass it around
no bottles of beer on the wall

Keymaker said on 05/29/05 22:28:24

If anyone's interested, here's my version of 99 bottles of beer, written in brainfuck:
http://www.bf-hacks.org/hacks/beer.b

My version notices that to print '1 bottle' when there's only one bottle and 'no more bottles' when there's none left. As well, it doesn't print any unneeded zero-digits. When there are no tens left, it prints only the ones.

The code, however, is far from the clear and commented program you can see here -- it's a bit smaller and quite complex (for layperson, at least).

andy paczkowski said on 05/30/05 07:04:20

I've just read your comments and I fixed up the code (though it's now longer) and cleared out some stupid errors I made such as using "<[<]" instead of just "[<]." Here's the printout of the last 2 verses:

2 bottles of beer on the wall
2 bottles of beer
take one down and pass it around
1 bottle of beer on the wall

1 bottle of beer on the wall
1 bottle of beer
take one down and pass it around
no bottles of beer on the wall

I'll send it in now. Thanks for the feedback, guys!

MaxD said on 07/06/05 07:00:01

hah, brainfuck is the most hilarious language, how did you ever spend the time learning how to do that?

Here's another version with a slightly different approach. It's also "full-featured", but is much smaller, uses fewer cells and supports arbitrarily large beer shelfs (within cell storage limitations of the interpreter).

http://iki.fi/aki.rossi/bf/bottles.b

Also available as a commented version for the faint-hearted (missing for the moment are comments to the integer-to-string conversion part):

http://iki.fi/aki.rossi/bf/bottles.commented.b

The main difference here is to not spend effort in pregenerating strings, instead using a few chosen output registers to speed up generation of ASCII characters on the fly. Some care was also taken to avoid redundancy.

matt said on 10/23/06 15:51:42

Now thats what I call a proper language!

gusc said on 04/11/07 22:29:24

To Aki Rossi: Now that's what I call an OPTIMIZATION!! Chears mate!

Andre said on 04/16/07 11:34:37

The hell?????? - just...why? Why? WHAT??

Mama's Boy said on 06/21/07 15:42:38

How can I show my mom this site, when it says Fuck right on the tops list? :(

crazzy said on 10/04/07 07:32:09

nice code, but i prefer assembly and c++... maybe i write somthing that instead of interpret compiles the shit and makes it self-executable...

FunkyTim said on 12/18/07 16:08:14

crazzy: Compiled code is great, but just because a language is interpreted doesn't mean it is a bad language. For example, Perl is a very powerful language that is used by millions of coders around the world, and surprise! It is completely interpreted. Just something to think about.

Trilce said on 09/06/08 18:05:04

And there is actually a compiler for Brainfuck. It's called brainfucked but it's only for DOS (output are COM files). Hope linux users will get one soon.

ruben said on 09/23/08 14:24:40

the readability is great..... XD

Sam Witse said on 09/24/08 14:09:20

Real programmers only use Brainfuck.

dennis loepke said on 10/22/08 10:24:09

nö..nö...nö keen bock....brainfuck

iblis said on 12/13/08 22:04:50

Trilce - http://code.google.com/p/awib/

Apparently, there's been a linux compiler for quite some time. :D

Trilce said on 01/08/09 02:33:34

Thanks iblis. After I comented there I got aware of awib (Also Written In Brainfuck). Incredible, it is really a compiler for Linux on i386 written ONLY IN BRAINFUCK. Of course it can compile itself.

There is also another compiler by Brian Raiter that outputs ELF format executables written in Assembler (NASM). It is particulary small (171 bytes) but It works great.
Check it out
http://www.muppetlabs.com/~breadbox/software/tiny/

Matus Goljer said on 12/07/09 23:30:58

Here's my latest attempt to write a Brainfuck interpret in Befunge-98, I think some of you might enjoy: http://fi.muni.cz/~xgoljer/bf.txt

The same in english:
Since my BF interpreter succeeded in running this code, I assume that my interpreter is working correctly. Or: The above code has an error that compensates the one in my interpreter.