real language

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

Language CBOT

Author:Jordan Wade
Score: (3.25 in 4 votes)
extern void object::BottlesOfBeer()

//99 Bottles of Beer on the Wall, by Jordan Wade in CBOT (the Colobot (a 
game from Epsitec) programming language)

int beers; //Number of bottles left

float speed = 1;

/* Speed settings:
0.125 - One message at a time... (54s per bottle, ~ 1.5 hours for song)
 0.25 - Quater speed
  0.5 - Half speed
    0 - DO NOT USE
    1 - Normal
    2 - Double speed
    4 - Quad speed
    8 - Near constant
   16 - Very close to constant
   32 - Constant

//FYI: Any wait instructions can be removed, but since Colobot shows
//     only 4 messages at any one time, you will probably only see the
//     last bottle

for(beers = 99; beers > 0; beers--)

//These will display in green boxes

message(beers + " bottles of beer on the wall,", DisplayInfo);
wait(1 / speed);
message(beers + " bottles of beer!", DisplayInfo);
wait(1.75 / speed);
message("Take one down and pass it around,", DisplayInfo);
wait(1.5 / speed);
message((beers - 1) + " bottles of beer on the wall!", DisplayInfo);

wait(2.5 / speed); //Wait time between bottles (in seconds)


//And these will display in brown boxes

//Only one beer left!
message("1 bottle of beer on the wall,");
message("1 bottle of beer!");
message("Take one down and pass it around,");
message("No bottles of beer left on the wall!");


Download Source | Write Comment

Alternative Versions


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: