Language GProlog
Date: | 04/20/05 |
Author: | Paul J. DeMarco |
URL: | n/a |
Comments: | 5 |
Info: | n/a |
Score: | (3.02 in 382 votes) |
/******************************************************* * 99 Bottles of Beer * Paul J. DeMarco 9/20/2002 * beer.pro * To execute start gprolog (others may work) * consult('beer.pro'). * drink(beer,99). *******************************************************/ english(beer,0):- write('no more bottle of beer'). english(beer,1):- write('1 bottle of beer'). english(beer,X):- X >= 2, write( X ) , write(' bottles of beer'). drink(beer,X):- X >= 1, english(beer,X), write(' on the wall, '), english(beer,X), write(', take one down, pass it around\n'), X1 is X - 1, english(beer,X1), write(' on the wall.\n'), drink(beer, X1).
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
Frederic said on 08/21/06 19:01:48
This is exactly what I was looking for. Works perfectly.
Steve Smart said on 10/16/06 00:57:58
Brilliant!
Braam said on 01/24/08 15:32:30
Brilliant? because its writing it 99 times?
This is not even a Full lyrics version!..Far from brylliant!
Tristan said on 01/28/08 09:20:51
LOL
this code is shorter than short
mozzy said on 11/25/08 21:11:47
Works with SWI-Prolog as well.