Voting

Category

esoteric language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language Brainfuck

(lean and mean)

Date:06/29/07
Author:Aki Rossi
URL:n/a
Comments:5
Info:http://www.muppetlabs.com/~breadbox/bf/
Score: (3.65 in 17 votes)
################################################
#                                              #
# 99 bottles of beer in 976 bytes of Brainfuck #
# Composed by Aki Rossi                        #
# aki dot rossi at iki dot fi                  #
#                                              #
################################################

#
# Set beer counter to 99
#
>>>>>>>>>
>++++++++++[-<++++++++++>]<-
<<<<<<<<<

#
# Create output registers
#
++++++++++[->++++>++++>++++>++++<<<<]	add 0x28 to all from (1) to (4)
++++++++[->>>++++++++>++++++++<<<<]	add 0x40 to all from (3) and (4)
++++[->>>>++++<<<<]			add 0x10 to (4)
++++++++++				set (0) to LF
>--------				set (1) to SP
>++++					set (2) to comma

>>>>>>>			go to beer counter (9)
[
	# Verse init
	<<<<
	+++	state 1 in (5)
	>+	state 2 in (6)
	>++	state 3 in (7)
	<<	go to (5)
	[
		#####################
		# N bottles of beer #
		#####################
		>>>>		go to (9)
		[
			# Print the number in (9)
			# (conversion routine uncommented to save space)
			[->+>+<<]>>[-<<+>>]<[>++++++++++[->>+>+<<<]
			<[>>>[-<<<-[>]>>>>[<[>]>[---------->>]<++++
			++[-<++++++++>]<<[<->[->-<]]>->>>[>]+[<]<<[
			->>>[>]<+[<]<<]<>>]<<]<+>>[->+<<+>]>[-<+>]<
			<<<<]>>[-<<+>>]<<]>[-]>>>>>>[>]<[.[-]<]
			<<<<<<
			# and remain in (10) which is empty
		]>+<<	inc (11) and go to (9)
		[>]>>	if (9) empty go to (11) else (12)
		[
			<<<<<<<		go to (3)
			++++++.+.	no
			-------		reset (3)
			>>>>>>>		go to (11)
			>>		go to (12)
		]
		<[-]<[-]<		empty (11) and go to (9)
		<<<<<<<<.	SP
		>>------.	b
		+++++++++++++.	o
		>----..		tt
		<---.		l
		-------.	e
		>>>>>>->>>+<<<	dec (9) inc (11)
		[>]>>
		[	now in (12)
			<<<<<<<<	go to (4)
			-.+		s
			>>>>>>>		go to (11)
		]
		>-<<<+<<<<<
		<<<.		SP
		>>>-----.	o
		<+.		f
		<<.		SP
		>>----.		b
		+++..		ee
		>+++.		r
		<+++>++++++	reset registers

		>>		go to (6)

		###############
		# on the wall #
		###############
		[
			<<<<<.		SP
			>>+++++++.-.	on
			<<.		SP
			>>>----.	t
			<------.---.	he
			<<.		SP
			>>>+++.		w
			<----.		a
			+++++++++++..	ll
			---->+>>	reset and go to (6)
			-		dec (6)
		]

		#
		# comma LF
		#
		<<<<.
		<<.
		
		####################################
		# take one down and pass it around #
		####################################
		>>>>>>>		go to (7)
		-		dec (7)
		[>]>>		if not blank then skip loop
		[
			-		dec (9)
			<<<<<		go to (4)
			----.		t
			<-------.	a
			>---------.	k
			<++++.		e
			<<.		SP
			>>>++++.-.<.	one
			<<.		SP
			>>-.>+.		do
			++++++++.	w
			---------.	n
			<<<.		SP
			>>---.>.<+++.	and
			<<.		SP
			>>>++.<---.	pa
			>+++..		ss
			<<<.		SP
			>>++++++++.>+.	it
			<<<.		SP
			>>--------.	a
			>--.---.	ro
			++++++.		u
			-------.	n
			<+++.		d
			++++>++++++++++	reset registers
			<<.		comma
			<<.		LF
			>>-----------	set (2) to excl mark
			>>>>+		inc (6)
			>>>>		go to (10)
		]
		<<<
		<<		go to (5)
		-		dec (5)
	]
	>>+		inc (7)
	<<<<<<<.	LF
	>>+++++++++++	reset comma
	>>>>>>>		go to beer counter (9)
]

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
original versionAndrew Paczkowski05/30/0524
Exact and complete lyricsRaphaël Bois03/07/083
slightly improved versionMark Hurd07/01/052

Comments

>>  SirBe said on 08/03/07 15:20:58

SirBe Brainfuck is so sexy.

>>  medard said on 08/08/07 23:48:46

medard great!!:D i can't find any compiler :(

>>  Ian Osgood said on 12/02/07 21:09:21

Ian Osgood Try my interpreter at the link. To make it finish more quickly, replace the second line

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

with something smaller, like

+++

>>  Ukuk said on 07/13/09 19:13:43

Ukuk Try +++++[>+++++<-]>[-<++++>]<- instead, to get 99, it is 1 char shorter (:

>>  Anonymous said on 08/19/10 10:32:11

Anonymous After she met in prada sunglasses and I think this girl is so cute, is not love to speak (later know that this is because people know him), wearing a fashionable dress, it is clear she air max is not a rigid little womens winter boots girl. Since then my discount boots attention is air max 95 completely into the body of this lovely girl. All this proves that I did not dust free for many moncler women years air max 95 and uk uggs so emotional, but ultimately I chose to uk ugg boots escape, few pedestrians prada store walking in sale winter boots the streets of stepping on his own winter boots on sale shadow, I admit, cheap winter boots I was weak, though I tried to you forget, but I can ugg boots not, I'm afraid of walking alone on this feeling moncler jackets of solitude. Leaves were gone, air jordan 12 return to earth. However, people sheepskin ugg boots who can have life calm and no love, no hate, no resentment, no regret? ! I ... ... can not. But cheap ugg boots even if we have missed the hand, but I have to tell you know you are nike air max shoes my lucky prada handbags life. Perhaps it should be, just have your back!

Download Source | Write Comment

Add Comment

Please provide a value for the fields Name, Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.

Please don't post large portions of code here! Use the form to submit new examples or updates instead!

Name:

eMail:

URL:

Security Code:
  
Comment: