Language Inform
(version 6)
| Date: | 04/20/05 |
| Author: | Torbjörn Andersson |
| URL: | n/a |
| Comments: | 0 |
| Info: | http://www.doggysoft.co.uk/inform |
| Score: |
Inform 6 is version 6 of a compiler meant for writing adventure games
for the so-called "Z-machine" created by Infocom. It seems to be
more object oriented than the original sent to me.
<a href=http://www.doggysoft.co.uk/inform>Click here</a> for more information.
! -----------------------------------------------------------------------------
! 99 Bottles of Beer on the Wall, Inform 6 version.
!
! Torbjörn Andersson, (d91tan@Student.DoCS.UU.SE), August 1997
! -----------------------------------------------------------------------------
Constant NUM_BOTTLES 99;
Object wall
private
bottles_left,
with init [ n;
self.bottles_left = n;
],
bottle_name [;
if (self.bottles_left == 1)
return "bottle";
return "bottles";
],
bottle_count [;
return self.bottles_left;
],
take_one_down [;
self.bottles_left--;
];
[ Main;
wall.init(NUM_BOTTLES);
while (wall.bottle_count() > 0) {
print
"^",
wall.bottle_count(), " ", (string) wall.bottle_name(),
" of beer on the wall,^ ",
wall.bottle_count(), " ", (string) wall.bottle_name(),
" of beer^You take one down and pass it around^ ";
wall.take_one_down();
if (wall.bottle_count() == 0)
print "No more";
else
print wall.bottle_count();
print " ", (string) wall.bottle_name(), " of beer on the wall.^";
}
];
Download Source | Write Comment
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!
Comments