real language

Bookmarking Digg Diigo DZone Earthlink Google
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language Inform 7

(Natural Inform)

Author:David Short
Score: (3.00 in 28 votes)
"Ninety-nine bottles of beer" by David Short

The wall is a room.  A bottle is a kind of thing.  In the wall are 99 bottles.

To say how many:
  say "[if no bottle is in the wall]no[otherwise][the number of bottles in the wall in words]".
To say how many in sentence case:
  say "[how many]" in sentence case.

To sing the song:
  if a bottle is in the wall
    say "[How many in sentence case] bottle[s] of beer on the wall, [how many] bottle[s] of beer.
    let the next one be a random bottle in the wall; silently try taking the next one;
    say "Take one down and pass it round, [how many] bottles of beer on the wall.[paragraph
    sing the song;
    say "No more bottles of beer on the wall, no more bottles of beer.";
    say "Go to the store and buy some more, ninety-nine bottles of beer on the wall!";
    end the game saying "end of the song";
  end if.

When play begins: sing the song.  Use no scoring.

Download Source | Write Comment

Alternative Versions


>>  David Short said on 09/24/08 07:13:06

David Short

>>  barrym said on 06/20/10 05:58:07

barrym May I suggest that someone provide coding for the plural and singular cases,
in accordance with the official lyrics, instead of saying 'bottle(s)' in the
first place?

>>  David Short said on 07/06/10 04:05:47

David Short

>>  barrym said on 07/06/10 08:35:02

barrym Please forgive my ignorance. I didn't actually execute your code, but I deduced
(incorrectly according to you) that Inform wasn't smart enough to automatically
remove the 's' from '1 bottles'. My education is now complete.

>>  barrym said on 07/12/10 01:47:02

barrym David, when I pasted your source into Inform 7 and added the brackets around 's' in
the 'Take one down' line, I ended up with 'one bottle' just fine, but I also ended
up with 'no bottle' in the second-to-last verse. I don't know how to fix it, but I
thought that you should be aware of the minor glitch.

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!




Security Code: