[eggPlant Functional] Useless SenseTalk Scripts

As the title suggests, this script is entirely useless… but once in a while it’s good just to have some fun! Then again, maybe you’ll even get some good ideas from this about SenseTalk scripting… uh … no, forget that thought. But if it inspires you to do something equally silly, don’t hesitate to send it our way!

This script was inspired by the website http://99-bottles-of-beer.net where you can find examples written in well over 1000 different programming languages. This script has been submitted as a SenseTalk example, so once it shows up there (they said it may take a while) you can go and vote for it!

But first, copy this into a new script and run it. Then relax and enjoy!

Cheers! :wink:


NinetyNine Bottles Of Beer
on theWall
	ninetyNine bottles of beer,
	take "one down and pass it around, "
	ninetyEight bottles of beer 
end on theWall

to handle ninetyNine libations, pouring
	global beer
	if the bottles of beer are empty then
		set the bottles of beer to be ninety plus nine
		put one into my drink 
		theWall friend, yes, the bottles of beer are there
	else if libations are flowing then
		drinkUp my hearties
	else
		shout the cheer of bottles of beer
	end if
end ninetyNine

to handle ninetyEight rounds
	if global happiness is achieved then return smiling
	ninetyNine flowing, faces are glowing
	if the number of items in the callStack \
			is greater than four times my drink then return my beer
	repeat while global happiness is not achieved
		theWall again, theWall
	end repeat
end ninetyEight

to take One, from
	global beer
	if bottles of beer are "no more" then
		write "Go to the store and buy some more, "
		put ninety-nine into bottles of beer
		set global happiness to achieved
		ninetyNine flowing, again, people are happy
	else
		write "Take" && one
		subtract my drink from bottles of beer
		if bottles of beer is less than my drink
		then set the bottles of beer to be "all gone"
	end if
end take

to shout HURRAH
	put capitalized of hurrah & " on the wall, " & HURRAH & "."
end shout

to cheer beer
	put " bottle of beer" into bottles
	try to put (if beer is more than one then "s" else empty) \
			after the first word in bottles
	start using me
	if beer is "all gone" then
		put "no more" into beer
		get beer
	else
		get the joy of beer
	end if
	put it into glass
	return glass & bottles
end cheer

to drinkUp beer
	if bottles of global beer is my drink then put bottle into bottles
	write the joy of bottles of global beer && bottles && "of "
	put "beer on the wall!",,
end drinkUp

to handle joy of beer
	if beer is "all gone" then return "no more"
	set wine to nine
	set my hopes to the taste of beer
	set my dreams to beer's foam
	if my hopes are empty then
		if beer is greater than wine 
		then set my dreams to the gusto of beer 
		else get the fruit of my vine
	else if my dreams are not empty then
		put my doubts after my hopes
	end if
	return all of my hopes & all of my dreams
end joy

to taste beer
	return item ten minus beer div ten of ("ninety", "eighty", \
			"seventy", "sixty", "fifty", "forty", "thirty", "twenty")
end taste

to handle foam top
	return item ten minus top rem ten of ("nine", "eight", \
			"seven", "six", "five", "four", "three", "two", "one")
end foam

to handle gusto now
	if now is less than twenty
	then return item twenty minus now of ("nineteen", \
			"eighteen","seventeen", "sixteen", "fifteen", \
			"fourteen", "thirteen", "twelve", "eleven", "ten")
end gusto

to handle all smiles
	return smiles
end all

properties
	doubts: "-"
end properties

1 Like

And while you are at it, make sure to drop by and vote for the less snazzy, smaller, compact and simple stupid version I did about 3+ years ago… http://99-bottles-of-beer.net/language-sensetalk-671.html

Todd, you have entirely too much time on your hands :lol:

I couldn’t match the epic poetry of @SenseTalkDoug but I took a stab as well since it seemed like good coding practice :wink: I guess I need to get more creative and work on a v2.0 that really leverages the freedom of SenseTalk! With a nod to my roots I updated it a touch; I understand that Irish kegs have 88 pints so…

put 88 into pints

repeat with kegGuinness = pints down to 1
	put kegGuinness into thisGuinness
	put kegGuinness - 1 into anotherGuinness
	
	put empty into pintGuinness
	if thisGuinness >1 then put "pints" into pintGuinness else put "pint" into pintGuinness

	put empty into anotherGuinnessPlease
	if anotherGuinness >1 then put "pints" into anotherGuinnessPlease
	else if anotherGuinness = 1 then put "pint" into anotherGuinnessPlease
		else put "pints" into anotherGuinnessPlease
	
	log thisGuinness && pintGuinness && "of Guinness at the pub,"  && thisGuinness && pintGuinness && "of Guinness."
	log "Tap the keg and pass one around," && anotherGuinness && anotherGuinnessPlease && "of Guinness at the pub."
	log empty
	
	if kegGuinness  = 1 then
		log "No more pints of Guinness at the pub, no more pints of Guinness."
		log "Go 'round the back and roll out a keg, 88 pints of Guinness at the pub!"
		exit repeat
	end if
end repeat

We love this! A great introduction to the comprehensibility of Sensetalk and to the 99-bottles-of-beer website, and we get to upvote this when it appears too!

Thanks for sharing, folks :grinning: - it is indeed good to have some fun once in a while.

1 Like

Thanks for that, @chrisbryant – I appreciate your Irish twist on the theme! And I haven’t looked at my entry in a long time. It’s good to see that it still runs!

Cheers, everyone!

1 Like