Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language Game Maker Language

(1 var, no loops/recursion, EOB adaptable)

Date:10/24/09
Author:brac37
URL:n/a
Comments:0
Info:http://www.yoyogames.com
Score: (2.00 in 1 votes)
/* Lyric 99 bottles of beer.
 * This script has only ONE variable.
 * This script has only TWO statements.
 * This script does NOT have case selection and neither has loops. 
 * This script does NOT call scripts, i.e. not other scipts and
 * no recursive calls.
 * This script does NOT execute strings with case selection 
 * (IF and SWITCH) and neither strings with loops.
 * This script DOES use string_repeat, but the repeat argument is 
 * always a PROPER integral constant and no boolean. 
 * The value of EOB (End Of Beer) is 100, but can easily be adapted
 * to any value greater than 3.
 */
a := string_replace_all (
  "a := string_replace_all (a, string(EOB), string(EOB - 1));" +
  "a := string_replace_all (a, '(0', '(0 + 1');" +
  "a := string_repeat (a, 2 - 1);" +  
  "show_message (string_repeat ('No more', 1 + 1 - 2) + " +
  "  string_repeat (string(EOB - 1), 2 - 1) + ' bottle' + " + 
  "  string_repeat ('s', 3 + 1 + 1 - 2 - 2) + ' of beer on the wall, ' + " +
  "  string_repeat ('no more', 1 + 1 - 2) + " +
  "  string_repeat (string(EOB - 1), 2 - 1) + ' bottle' + " + 
  "  string_repeat ('s', 3 + 1 + 1 - 2 - 2) + ' of beer.#' + " +
  "  string_repeat ('Go to the store and buy some more, ', 1 + 1 - 2) + " + 
  "  string_repeat ('Take one down and pass it around, ', 2 - 1) + " + 
  "  string_repeat (string(0), 1 + 1 - 2) + " +
  "  string_repeat ('no more', 2 + 2 - 1 - 3) + " +
  "  string_repeat (string(EOB - 2), 3 - 2) + ' bottle' + " +
  "  string_repeat ('s', 4 + 2 + 1 - 3 - 3) + " +
  "  ' of beer on the wall.');" +
  "execute_string (a); ", "EOB", "100");
execute_string (a);

Download Source | Write Comment

Alternative Versions

VersionAuthorDateCommentsRate
GMLv6, requires no extra coding to enablScoochi205/04/072
2Jake Gilbert05/25/058

Comments

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!

Name:

eMail:

URL:

Security Code:
  
Comment: