Download code

Jump to: navigation, search

Back to 99_Bottles_of_Beer_(Inform_7)

Download for Windows: single file, zip

Download for UNIX: single file, zip, tar.gz, tar.bz2

99bottles.inform7

 1 [ The authors of this work have released all rights to it and placed it
 2 in the public domain under the Creative Commons CC0 1.0 waiver
 3 (http://creativecommons.org/publicdomain/zero/1.0/).
 4 
 5 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 6 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 7 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 8 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 9 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
10 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
11 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 
13 Retrieved from: http://en.literateprograms.org/99_Bottles_of_Beer_(Inform_7)?oldid=8990
14 ]
15 
16 "99 bottles" by Dave
17 
18 A wall is a kind of room.  A wall has a number called the inventory.
19 To stock (w - a wall) with (n - a number) bottles: change the inventory of w to n.
20 To drink from (w - a wall): decrease the inventory of w by 1.
21 To say beer count of (w - a wall): say "[inventory of w] bottle[s] of beer".
22 To act on (w - a wall):
23 	say "take one down and pass it around, ";
24 	drink from w;
25 	say "[beer count of w].[line break]";
26 	say "[beer count of w] on the wall, [beer count of w].";
27 	act on w.
28 Definition: a wall is empty if its inventory is zero.
29 To say beer count of (w - an empty wall): say "no more bottles of beer".
30 To act on (w - an empty wall): say "go to the store to buy some more, ".
31 
32 To versify on (w - a wall) with (n - a number) bottles:
33 	stock w with n bottles;
34 	say "You start to sing:[line break]";
35 	say "'[beer count of w] on the wall, [beer count of w].";
36 	act on w;
37 	stock w with n bottles; say "[beer count of w].'".
38 caterwauling is an action applying to a number.
39 understand "sing [a number]" as caterwauling.
40 understand "[a number]" as caterwauling.
41 instead of singing: change the number understood to 99; try caterwauling.
42 carry out caterwauling: 
43 	let n be the number understood;
44 	versify on the stage with n bottles.
45 The stage is a wall. "type 'sing' to sing '99 bottles of beer'".
46 test me with "sing".


hijacker
hijacker
hijacker
hijacker