Carey's Silly Bottles of Beer

From Gwen Morse's Wiki
Jump to: navigation, search

Found this programming project to loop through "99 Bottles Of Beer on the Wall" in different languages. This one is written as a set of Tinyfugue macros. It's silly but can be fun if you're restrained in your usage.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Tiny Fugue
;; Tiny Fugue is a mud client language
;; http://www.westnet.com/mirrors/99bottles/beer_s_z.html
;;
; 99 bottles of beer in TF macros.
; by Carey Evans.
;
; Type "/beer" to use after loading it.

;; /def beerecho = /echo - %{*}
;; /def beerbreath = /echo

; Uncomment the following lines instead to send to the MUD:
/def beerecho = say %{*}
/def beerbreath = :takes a deep breath.

/def beerbottles = \
    /if ({1} == 1) /echo 1 bottle of beer%; \
    /else /echo %{1} bottles of beer%; \
    /endif

/def beer1 = /beerecho $(/beerbottles %{1}) on the wall%2
/def beer2 = /beerecho $(/beerbottles %{1}).
/def beer3 = /beerecho Take one down and pass it around,

/def beer = \
    /let bottles=%{1-99}%; \
    /while ( bottles > 0 ) \
	/beer1 %{bottles} ,%; \
	/beer2 %{bottles}%; \
	/beer3%; \
	/let bottles=$[bottles - 1]%; \
	/if ( bottles == 0 ) /break%; /endif%; \
	/beer1 %{bottles} .%; \
	/beerbreath%; \
    /done%; \
    /beerecho No more bottles of beer on the wall.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;