Voting

Category

real language

Bookmarking

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

Language TADS 3

Date:04/20/05
Author:Jim Nelson
URL:n/a
Comments:0
Info:http://www.tads.org/
Score: (4.00 in 5 votes)
// TADS 3 (Text Adventure Development System) is a language 
// for crafting interactive fiction.  More information can 
// be found at http://www.tads.org/.

// 99 bottles of beer on the wall.
// 17 June 2002 Jim Nelson <jim_nelson@mindspring.com>

main(args)
{
	local bottles = 99;
	local number = bottles;
	local plural = 's';
	
	for(;;)
	{
		"<<number>> bottle<<plural>> of beer on the wall,\n";
		"<<number>> bottle<<plural>> of beer,\n";

		if(bottles == 0)
		{
			break;
		}
		
		"Take <<(bottles != 1) ? 'one' : 'it'>> down, pass it around,\n";

		bottles--;
		if(bottles > 1)
		{
			plural = 's';
			number = bottles;
		}
		else if(bottles == 1)
		{
			plural = '';
			number = 'One more';
		}
		else
		{
			// zero
			plural = 's';
			number = 'No more';
		}

		"<<number>> bottle<<plural>> of beer on the wall.\n\b";
	}

	"Go to the store, buy some more,\n";
	"99 bottles of beer on the wall.\n\b";
}

Download Source | Write Comment

Alternative Versions

Comments

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: